View git log without merge commits

青春壹個敷衍的年華 提交于 2020-01-22 05:33:06

问题


I'm trying to view commits made by a specific user, and want to remove any merges done by the user from the output. How can I do so?

I can check for the commits of a user using git log --author=<name>, but can't remove the merge commits in the output.

PS: Merge conflicts do not happen in the workflow of the repo in question, all branches are rebased before merging into master so it is safe to remove the merge commits from the output, and similarly, two feature branches are not merged with one another raising the possiblity.


回答1:


use

git log --author=<name> --no-merges

Additionally the --first-parent option may give useful result for you:

--first-parent Follow only the first parent commit upon seeing a merge commit. This option can give a better overview when viewing the evolution of a particular topic branch, because merges into a topic branch tend to be only about adjusting to updated upstream from time to time, and this option allows you to ignore the individual commits brought in to your history by such a merge. Cannot be combined with --bisect.




回答2:


You can omit merges with --no-merges:

git log --no-merges --author=<name>

See the git log manpage for details.



来源:https://stackoverflow.com/questions/35945860/view-git-log-without-merge-commits

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