I try git log
w/ --decorate
and --source
options. But still can not get the branch name of commit 2f3cb60
and d7e7776
, Why?
#git log 2f3cb60 --graph --decorate --source --all --oneline
...
* | | | 1920ad5 refs/heads/gpio support gpio lib
| |/ /
|/| |
* | | 2f3cb60 2f3cb60 fix
* | | d7e7776 2f3cb60 fix
| |/
|/|
* | aa4dcfb refs/remotes/origin/httpd support
* | cfc839d refs/remotes/origin/httpd add folder
How do I show git log with branch name?
git log --graph --decorate --oneline
should show you names of the commits that have names. Not every commit is associated with a branch name.Remember, a branch name is just a pointer to a particular commit. Each commit has a parent, so one commit may be a part of the history of a dozen separate branches.
git branch --contains <ref>
.git name-rev <ref>
.If you need a shell-scriptable ("plumbing") list of all branches containing a commit, try this:
See also: SO: Finding what branch a commit came from