Show log for another branch

I am in a branch with some changes. Changing a branch is a pain since some files are blocked by processes, so to change a branch I would have to stop all processes that have locks, and then stash changes before checking another branch to see it in the log.

Can I view the log for another branch without checking it?

+8
git git-branch version-control git-log
source share
1 answer

TL; DR

Using

 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 syntax given in that command page

 git log [<revision range>] 

Further down you can find the following snippet:

If <revision range> not specified, by default it is HEAD (i.e., the whole history leading to the current commit)

This suggests that git log equivalent to git log HEAD . If you are on a branch called mybranch , let's say this command is also equivalent to git log mybranch .

You want to restrict access to the log to achieve reachability from another branch, that is, a branch that you are not currently in. The easiest way to do this is to explicitly pass the name of the branch of interest to git log :

 git log <branchname> 

More information on the many forms that the <revision-range> argument can take can be found in the gitrevisions manpage .

+15
source share

All Articles