当我在 git 中使用 git diff 命令时,我看到如下输出:
@@ -35,14 +41,12 @@
无法理解这意味着什么。我猜减号表示删除时的一行,+表示插入时的行。我说得对吗?
最佳答案
A hunk begins with range information and is immediately followed with the line additions, line deletions, and any number of the contextual lines. The range information is surrounded by double-at signs, and combines onto a single line what appears on two lines in the context format (above). The format of the range information line is as follows:
@@ -l,s +l,s @@ optional section heading
The hunk range information contains two hunk ranges. The range for the hunk of the original file is preceded by a minus symbol, and the range for the new file is preceded by a plus symbol. Each hunk range is of the format l,s where l is the starting line number and s is the number of lines the change hunk applies to for each respective file. In many versions of GNU diff, each range can omit the comma and trailing value s, in which case s defaults to 1. Note that the only really interesting value is the l line number of the first range; all the other values can be computed from the diff.
关于git - "@@"之间的信息在git diff中意味着什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25327496/