Skip to content

Instantly share code, notes, and snippets.

@cddr
Created July 11, 2013 19:09
Show Gist options
  • Save cddr/5978313 to your computer and use it in GitHub Desktop.
Save cddr/5978313 to your computer and use it in GitHub Desktop.
Find the first few branches that contain the specified commit
# Find the pull request that introduced a given commit
COMMIT=c78f9ef # just an example commit id
# This will list the first few branches that contain this commit (including only "pull request" branches)
git branch -r --contains $COMMIT |grep "origin/pr" |sort |head
@jasisk
Copy link

jasisk commented Jul 17, 2013

Don't forget, you can use the :/words syntax to find a commit by commit message. E.g.,

git branch -r --contains :/CMGRS-911 | grep "origin/pr" | sort | head

@jasisk
Copy link

jasisk commented Jul 17, 2013

Also, you need to have this set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment