3 ms·
This approach also helps with those orphan branches since it just calculates the diff caused by bringing the orphan branch into the mainline. Whereas OP's defi
by gsylvie 10y ago
This approach also helps with those orphan branches since it just calculates the diff caused by bringing the orphan branch into the mainline.
Whereas OP's definition counts every line ever created on both sides (e.g., counts every line of code in the original project as well as the orphan at the moment of the merge).
- majewsky 10y agoIf you want the diff caused by bringing a topic branch into master (i.e. its unmerged parts), you can also do git diff master...topic with three dots instead of two.
- gsylvie 10y agoOr in this case (since we're processing merges one at a time to make the calculation): git diff COMMIT^1...COMMIT^2 (aka, parent1...parent2). I find the three-dot diff notation very useful, but confusing, and always have to type "git help diff" first and stare at the docs a bit to find this bit: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B" Also, I prefer first-parent since it gets the actual change to the mainline, whereas "git diff parent1...parent2" might miss some changes with dirty merges (e.g., conflict resolution). More info here: http://stackoverflow.com/a/41356308/5819286 http://stackoverflow.com/a/41356308/5819286