Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

Git Merge-Base: How to Get the Last Merged SHA

If you ever need to find out the SHA of the last time a Git branch was merged into another branch, then you can use this command:


Do not forget that this command will only determine the last merged SHA of the local repository. You would want to pull both branches first, if you want to guarantee the latest merged SHA on the latest copy of the repository.

Now, if you want to determine if there are any other SHAs not merged since the last merged SHA, then you can run this command:

git log SHA..HEAD

Where SHA is the last merged SHA attained from the first command above. Of course, this assumes full merges are done instead of cherry picking.

by Phil for Humanity
on 20121102

Related Articles
 » Git Log and Cat-File
 » The Price of Progress
 » Git Reset: Reverting Changes