Skip to content

Instantly share code, notes, and snippets.

@jeffjohnson9046
Last active May 28, 2019 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffjohnson9046/3c56d81bbf17e0ff030b0d710d6b6cb5 to your computer and use it in GitHub Desktop.
Save jeffjohnson9046/3c56d81bbf17e0ff030b0d710d6b6cb5 to your computer and use it in GitHub Desktop.
Search for commits in git
# From here: https://stackoverflow.com/questions/2706797/finding-what-branch-a-git-commit-came-from
# First, make sure you have everything locally:
$ git fetch --all --tags --prune
# Show the local branches a commit is on (the "b4f8b91" is the first 7 characters of the commit hash):
$ git branch --contains b4f8b91
develop
* feature/ast-3975
master
release/stage
# Show the remote branches a commit is on (the "b4f8b91" is the first 7 characters of the commit hash):
$ git branch -r --contains b4f8b91
origin/1.10.0.307-hotfixes
origin/1.11.0.301-passing-tickets
origin/AST-3671-Generate-Agreement-Performance
origin/AST-3984-Articulation-Perf-Infrastructure
origin/HEAD -> origin/develop
origin/ast-3995
origin/ast-3995-for-develop
origin/develop
origin/feature/3485-uctca-uctca-review-proposal-history
origin/feature/3722-error-terminating-course
origin/feature/3749-update-public-site-link
origin/feature/3880-map-legacy-institution-codes
origin/feature/3920-include-area-codes-in-label
origin/feature/3992-16-17-artifacts-showing-when-opted-out
origin/feature/add-distinct-for-agreement-get-ids
origin/feature/ast-3865-add-additional-lists
origin/feature/ast-3921-areas
origin/feature/ast-3975
origin/feature/ast-3998-transferability-refresh-primer
origin/feature/cherry-3800-3973
origin/feature/fix-references-for-savage
origin/feature/public-site-load-tests
origin/hotfix/3497-update-polyfill-queries
origin/hotfix/3903-disable-legacy-dept-agreements-ucla-uci
origin/hotfix/3934-singular-category-labels
origin/hotfix/3936-add-sdsu-to-archived-institutions
origin/hotfix/add-indexes-to-webjob
origin/hotfix/ast-3981
origin/master
origin/release/stage
# Search the reflog (the "b4f8b91" is the first 7 characters of the commit hash):
$ git reflog show --all | grep b4f8b91
b4f8b916 refs/heads/develop@{23}: pull origin develop: Fast-forward
# Find all subsequent merge commits (the "b4f8b91" is the first 7 characters of the commit hash):
$ git log --merges b4f8b91.. --pretty=oneline
3d9b810eace6e323d51c2a0abe3143f07b262ff8 (origin/develop, origin/HEAD, develop) Merge branch 'release/stage' of https://bitbucket.org/fairwaytech/assistng/src/develop into develop
c707481e6a6bffcd7f5a62e9c3000bb38f2021b0 (tag: 1.11.0.303, origin/release/stage) Merged in feature/3749-update-public-site-link (pull request #488)
db68ed3495fa98abe22c67a39185cbb5bda89daf Merged in 1.10.0.307-hotfixes (pull request #490)
e941ee0432adb2f6d90a110fbe1c7f3b524598eb (origin/1.10.0.307-hotfixes) Merged in ast-3995 (pull request #489)
492c3778624de7b57091abd05b43366fc0f32fbb Merged in ast-3995 (pull request #487)
484380c1a60566ac6289fcfbe15edeadb1ab92a1 Merge branch 'release/stage' of https://bitbucket.org/fairwaytech/assistng/src/develop into develop
f718f744099a164d6afcf343929cc22e300ef630 Merged in feature/3485-uctca-uctca-review-proposal-history (pull request #484)
7113427c178e0fb6737e8175bd54ea6ee8326bd6 (origin/feature/3485-uctca-uctca-review-proposal-history) Merge branch 'release/stage' of https://bitbucket.org/fairwaytech/assistng/src/develop into feature/3485-uctca-uctca-review-proposal-history
# ... and so on...
# A variant to find all subsequent merge commits since a commit. This shows the date, the committer and the commit message (the "b4f8b91" is the first 7 characters of the commit hash):
$ git log --merges b4f8b91.. --pretty='%h %ci %cN %s'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment