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:
|git merge-base --all MERGED_TO_BRANCH MERGED_FROM_BRANCH
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