I am writing an automatic tool based on git show
, which relies on git diff
command. I wrote a small parser which takes the output of git show as the text to parse, and in most situations in the result the lines start with '@@' indicates which lines it will compare.
However, I met an situation like this:
@@@ -460,22 -415,8 +460,22 @@@
What does that mean? Is it possible that there will be even more (4 or more) '@' symbols with even more subtle meanings?
You are showing a merge in combined diff format. If you look at the man-page of
git show
, it has a complete section aboutcombined diff format
, when it is used and how it looks like. Also in the initial description ofgit show
it says that merges will be shown likegit diff-tree --cc
which also refers to the combined diff format.And yes, there can be more than three
@
symbols. There will be one per parent commit + 1. So if you have a merge with three parents (a so-called octupus merge), there will be four at signs. If you have four parents, there will be five at signs and so on.