Where Is My Commit?

With continuous integration responsible for deployment, especially in the mid to large size team the following questions might be popping up time to time:

  • Is my commit went to production last night?
  • Is it on staging?
  • Where is my commit?

No worries, GIT got you covered:

1
git branch -r --contains <commit SHA>

This will show all remote branches where particular SHA is found, for example:

1
2
origin/master
production/master

Also, it might be good idea to fetch updates from remote branches in order to cover most recent change sets:

1
2
git fetch production master
git fetch origin staging

You can skip -r flag if only interested in local branches.

Caution!!!

SHA of commit is changed when you cherry-pick and therefore those won’t be shown in result set for the original commit SHA

Comments