From the git-branch manual page:
git branch --contains <commit>
Only list branches which contain the specified commit (HEAD if not specified). Implies
git branch -r --contains <commit>
See also this git ready article.
--containstag will figure out if a certain commit has been brought in yet into your branch. Perhaps you’ve got a commit SHA from a patch you thought you had applied, or you just want to check if commit for your favorite open source project that reduces memory usage by 75% is in yet.
$ git log -1 tests commit d590f2ac0635ec0053c4a7377bd929943d475297 Author: Nick Quaranto <email@example.com> Date: Wed Apr 1 20:38:59 2009 -0400 Green all around, finally. $ git branch --contains d590f2 tests * master
git branch -a --contains <commit>
MatrixFrog comments that it only shows which branches contain that exact commit.
If you want to know which branches contain an "equivalent" commit (i.e. which branches have cherry-picked that commit) that's
git cherry :
git cherrycompares the changeset rather than the commit id (sha1) , you can use
git cherryto find out if a commit you made locally has been applied
<upstream>under a different commit id.
For example, this will happen if you’re feeding patches
<upstream>via email rather than pushing or pulling commits directly.
__*__*__*__*__> <upstream> / fork-point \__+__+__-__+__+__-__+__> <head>
(Here, the commits marked '
-' wouldn't show up with
git cherry, meaning they are already present in