How can I print the log for a branch other than the current one?

BanksySan

I'm on a branch with some changes. Changing branch is a pain as some files are locked by processes, so to change branch I'd have to stop all the processes which have locks, then stash the changes before checking out the other branch to see its log.

Is it possible to view the log for a different branch, without having to check it out?

jub0bs

TL;DR

Use

git log <branch>

where <branch> is the name of the branch of interest.

From the git-log man-page...

A simplified version of the git-log synopsis given in that command's man page is

git log [<revision range>]

Further down, you can find the following passage:

When no <revision range> is specified, it defaults to HEAD (i.e. the whole history leading to the current commit)

In others words, git log is equivalent to git log HEAD. If you're on a branch, called mybranch, say, this command is also equivalent to git log mybranch.

You want to limit the log to commits reachable from another branch, i.e. a branch you're not currently on. The easiest way to do that is to explicitly pass the name of the branch of interest to git log:

git log <branchname>

See the gitrevisions manpage for more details about the many forms that the <revision-range> argument can take.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can I pull to a branch other than the one I'm on?

From Dev

How can I get all the files from one git branch, and put them into the current branch without merging?

From Dev

How can I use a branch other than master for User Github Pages

From Java

How can I create a Git repository with the default branch name other than "master"?

From Dev

How can I run "tail -f" on all log files in the current directory — except for one?

From Dev

How can I get git log to print the full hash and short stats of each commit on one line?

From Dev

Why can't I print more than one string?

From Dev

How can I block (ssh) traffic from source ports other than a pre-defined one?

From Dev

In elm, how can I pipe a value to a function as an argument other than the last one?

From Dev

How can I update to the end of the current unnamed branch?

From Java

How can I display the current branch and folder path in terminal?

From Dev

How can I avoid a foreach loop in a situation where I need data from more than one table linked to each other?

From Dev

How can I find out the git branch my current branch is based on?

From Dev

How can I check out a branch that manages a path with a submodule when the current branch does not?

From Dev

I can fetch one word, but not the other one, how can this be?

From Dev

how can I print from a different subnet than the printer?

From Java

How to 'git pull' into a branch that is not the current one?

From Dev

With directive comparing two inputs to make sure one is lower than the other, how can I trigger calculations on change of either input?

From Dev

Why changes in one branch can affect the other branch in git?

From Java

How can I print to Stderr in Go without using log

From Dev

nodejs loglevel: how can I print out the actual level of the log?

From Dev

How can I print/log the checksum calculated by rsync?

From Dev

How can I log or print multiple elements in an array in JavaScript?

From Dev

How can I list the files in other (non-current) directory?

From Java

How can I print error and other counts in Scrapy as integer variable?

From Dev

How can I save currency other than NSDecimalNumber?

From Dev

How can I check if a date is greater than the other?

From Dev

How can I order by a column of numbers in a base other than 10

From Dev

SVN How can i add 2 new files from one branch to another branch?

Related Related

  1. 1

    Can I pull to a branch other than the one I'm on?

  2. 2

    How can I get all the files from one git branch, and put them into the current branch without merging?

  3. 3

    How can I use a branch other than master for User Github Pages

  4. 4

    How can I create a Git repository with the default branch name other than "master"?

  5. 5

    How can I run "tail -f" on all log files in the current directory — except for one?

  6. 6

    How can I get git log to print the full hash and short stats of each commit on one line?

  7. 7

    Why can't I print more than one string?

  8. 8

    How can I block (ssh) traffic from source ports other than a pre-defined one?

  9. 9

    In elm, how can I pipe a value to a function as an argument other than the last one?

  10. 10

    How can I update to the end of the current unnamed branch?

  11. 11

    How can I display the current branch and folder path in terminal?

  12. 12

    How can I avoid a foreach loop in a situation where I need data from more than one table linked to each other?

  13. 13

    How can I find out the git branch my current branch is based on?

  14. 14

    How can I check out a branch that manages a path with a submodule when the current branch does not?

  15. 15

    I can fetch one word, but not the other one, how can this be?

  16. 16

    how can I print from a different subnet than the printer?

  17. 17

    How to 'git pull' into a branch that is not the current one?

  18. 18

    With directive comparing two inputs to make sure one is lower than the other, how can I trigger calculations on change of either input?

  19. 19

    Why changes in one branch can affect the other branch in git?

  20. 20

    How can I print to Stderr in Go without using log

  21. 21

    nodejs loglevel: how can I print out the actual level of the log?

  22. 22

    How can I print/log the checksum calculated by rsync?

  23. 23

    How can I log or print multiple elements in an array in JavaScript?

  24. 24

    How can I list the files in other (non-current) directory?

  25. 25

    How can I print error and other counts in Scrapy as integer variable?

  26. 26

    How can I save currency other than NSDecimalNumber?

  27. 27

    How can I check if a date is greater than the other?

  28. 28

    How can I order by a column of numbers in a base other than 10

  29. 29

    SVN How can i add 2 new files from one branch to another branch?

HotTag

Archive