How To Find a Git Commit ID in Branches and Merges

First, get on the branch that you know already has the commits you are looking for:
1 |
git checkout theBranch-1234 |
Copy-and-paste the commit(s) you want:
1 |
git log |
~or~
1 |
git log -p |
Optionally, display the code changes for a visual confirmation:
1 |
git show {one or more commit ID's} |
Finally, extract the list of branches that contain the desired commits:
1 2 |
git branch --contains CommitID-A git branch --contains CommitID-B |
Example:
1 2 3 |
git log git branch --contains 097e1859f248a7aa5e148a2a946be3e360030095 git branch --contains 24339549f9f1920a33f721d3faa2538c8ba5d249 |
Leave Your Comment
All fields marked with "*" are required.