Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git command to find commits made in branch that are not present in master

Tags:

git

github

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)

like image 763
Tarun Gupta Avatar asked Jan 10 '23 10:01

Tarun Gupta


1 Answers

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.

like image 123
SzG Avatar answered Jan 28 '23 22:01

SzG