git - "@@"之间的信息在git diff中意味着什么

标签 git diff

当我在 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.

来源:https://en.wikipedia.org/wiki/Diff#Unified_format

关于git - "@@"之间的信息在git diff中意味着什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25327496/

相关文章:

git - merge 时解决冲突后提交消息的问题

git - github 上的 ssh key

Git apply 不创建新文件?

php - 比较 4 个或更多文件

r - R中矩阵中每一列的相邻列求和

R:如何通过仅比较每个字符串中的前 3 个制表符分隔项来对两个字符串向量使用 setdiff?不使用 qdap

git - 从 Git 历史记录中删除文件而不删除文件

Git 裸仓库有 master 分支 checkout 吗?

git - 为什么我需要 SSH 授权才能克隆公开可用的 Git 存储库?

Git 的内存使用情况