简体   繁体   中英

git log, only commits that happened on branch pre-merge

If I have a structure like this.

    A---B---C----H---M      topic
   /       /  \     / \
  D----E---F---G---L---N    master
      /           /
 I---J           K          other topics

And I want to git log , only the commits that happened on the topic branch, without merges:
Specifically ABH , and nothing else.
How would I do that?

Try with the option --no-merge of git log :

git log --no-merges --first-parent topic

That is:

--no-merges

Do not print commits with more than one parent.
This is exactly the same as --max-parents=1 .

--first-parent

Follow only the first parent commit upon seeing a merge commit. This option allows you to ignore the individual commits brought in to your history by such a merge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM