How to know which branch a “git log” commit belongs to?

前端 未结 3 607
北荒
北荒 2020-12-12 19:07

If I do git log, is there any parameter I could specify to be able to tell from the output which branch every commit belongs to?

Edit: to clarify, I und

3条回答
  •  天命终不由人
    2020-12-12 20:04

    With git log you already get all the commits from the current branch you are on.

    If you want to see commits from merged branches you can use

    $ git log --pretty=oneline --graph
    

    To create a log tree and see what merged branches a commit stems from.

    --graph will make the commit tree and --pretty=oneline will make a one line visualization for every commit

    To add branches (as refs) to the log:

    $ git log --all --source --pretty=oneline --graph
    

    To display branches with commits:

    $ git show-branch
    

提交回复
热议问题