Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does git have an option to show the commits to be merged before performing the merge?

Tags:

git

For example, when I merge from master -> production, I'd like to see a list of the commits before I, err, commit to them. Something like:

$ git merge --doublecheck master
Commits to merge:
1292642 fix foo
3c0f30b cleanup bar
Do you want to proceed? (y/n)
like image 549
David Wolever Avatar asked Sep 11 '25 02:09

David Wolever


1 Answers

You can use revision range double-dot .. syntax to do this:

git log --oneline --graph <branch-to-merge-into>..<branch-to-be-merged>

The output will be all commits in <branch-to-be-merged> that aren't in <branch-to-merge-into>.

You can learn more about this and other revision range syntaxes in the Commit Ranges section of the FREE online Pro Git book.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!