Sakthisiga
Sakthisiga

Reputation: 93

Git log without merge commits

Hi I need to get the list files changed with lines added between a date range. Also I need to omit all the merge commits in it.

I used git log --no-merges --numstat --pretty="%H" --since "01/01/2016" --until "05/19/2016" | grep ".java$" | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}' and even if I run with "--no-merges" it shows the same count. Can anyone help me on this?

Upvotes: 0

Views: 312

Answers (1)

LeGEC
LeGEC

Reputation: 51850

It is actually the expected behavior.

Run the git log ... part of your command (before | grep ...) and see if your mege commits show up at all in the log.

Unless you had to solve a conflict when merging, git will not report any diff count for such a commit, because all the "diffs" actually comme from one of this merge's two parents.

Upvotes: 1

Related Questions