Show all commits in a git branch since original branching point from master

不打扰是莪最后的温柔 提交于 2019-12-04 21:52:16

问题


I'm looking for a way to view all commits on active branch since branching point (and including it) and hopefully since branching from master.

For example situation like:

A-B-C-D (master)
   \
    E-F (branch A)

I want to get commits F, E and B while F is the HEAD.

And for

A-B-C-D   (master)
   \
    E-F   (branch B)
       \
        G (branch C)

I want to get commits G, F, E, B in case G is current HEAD. Displaying this information with --graph option would be also great.

For now I have come up with

git log master^..HEAD

But it seems to be displaying too much information (like commits from other branches). Thanks for your help!


回答1:


From "How Do I run Git Log to see changes only for a specific branch?", this should be enough:

git log  --boundary master..
# or
git log  --boundary --no-merges master..

More concise representation:

git log --boundary --no-merges --pretty='%C(yellow)%h%d %Creset%an %Cgreen%ar:%Creset %s' --graph master..

(add --boundary, as torek comments, in order to include what 'B' commit which would otherwise be excluded from the git log result)



来源:https://stackoverflow.com/questions/20015808/show-all-commits-in-a-git-branch-since-original-branching-point-from-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!