How to show git log with branch name

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?

  • How to Add Remote with Git Gui?
  • How can I manage a different setup for my Ruby on Rails application dependent on production or development?
  • Git: Using a Makefile in untracked build directory
  • Does GitHub for Mac automatically git pull in the background?
  • Local repository with Git
  • Error during fetching git repository on Jenkins (not each time)
  • git: Log for 'master' only goes back to date bug?
  • how to push all files in a folder to all git branches
  • How can I configure the path to the Git executable in Android Studio?
  • .gitattributes: merge=ours strategy vs. fast-forward merging
  • How do I get the “sha” parameter from GitHub API without downloading the whole file?
  • BitBucket.org - limitations only number of users?
  • One Solution collect form web for “How to show git log with branch name”

    $ git log --graph --decorate --oneline
    * 1f3e836 (HEAD, origin/v2, v2) Change scripts to new format.
    *   34d458f (origin/master, master) Merge branch 'new-shell'
    |\  
    | * 995ece7 (origin/new-shell) Fix index.html and add script pushing.
    | * fe0615f New shell hello-world.
    |/  
    * fe1b1c0 Progress.
    ...
    

    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.

    • You can see which branches contain a commit via git branch --contains <ref>.
    • If you just need some kind of symbolic name to track down a commit, use git name-rev <ref>.
    • If you need a shell-scriptable (“plumbing”) list of all branches containing a commit, try this:

      commit=$(git rev-parse <ref>) # expands hash if needed
      for branch in $(git for-each-ref --format "%(refname)" refs/heads); do
        if git rev-list "$branch" | fgrep -q "$commit"; then
          echo "$branch"
        fi
      done
      

    See also: SO: Finding what branch a commit came from

    Git Baby is a git and github fan, let's start git clone.