Reputation: 1669
Looking for a git command which displays commits in a branch that are not merged to master yet, preferably with hash, date, author name and comment.
(This probably is a duplicate question but I couldn't find it on SO)
Upvotes: 5
Views: 4022
Reputation: 12619
To list commits that are not on master
but only only on branch
:
git log master..branch
It does not matter which branch is checked out, as you specify the range. Git will find the shortest route from master
to branch
, first going back on master
, not printing the commits, and then listing commits when going forward in history towards branch
.
The default format of git log
contains all the data you wish to see. But I'd use the --decorate
option too, to highlight branches and tags.
Upvotes: 8
Reputation: 154886
Use the ^master
syntax to exclude commits visible from master
(i.e. those merged to the master branch):
git log branch ^master
The format can be customized using the --format
option, e.g. --format="format:%H %ad %an %s"
Upvotes: 4