Here’s a neat Git command that might help you with listing merge commits for a specific Git branch.
Prerequisites
- Git
Solution
Go to your current working tree directory and run the following command:
git log <branch> --merges --first-parent
Note(s): In you are dealing with more than one parent, omit --first-parent
if you want to list merges from all commits. And, if you don’t specify the branch, you will get a list of merge commits from whatever commit your current HEAD points to.
Conclusion
To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.