View git log without merge commits

Viewed 53697

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.

3 Answers

The OP's question has been answered. I expounded on the answer for the lurkers. This lengthy log call will give you a nice view filtered by committer sans merge. Use git alias to tame this if you desire.

I hope it benefits someone and isn't treated too harshly with down-votes.

git log --no-merges --max-count=15 --pretty="format:%C(dim green) %<(9,trunc)%ar %C(bold magenta)%h %C(bold green)%<(12,trunc)%an %C(bold
yellow)%<(113,trunc)%s" --committer="<name>"

Example: enter image description here

Related