git - git diff 中的两个加号是什么意思?

标签 git

我正在执行 git diff,这是我第一次看到行旁边有两个加号。

++        if ($field_name == $selected) {
++
++        echo "field_type: {$field['type']}\n";
++        echo "field_name: {$field_name}\n";
++
++        foreach ( $node->$field_name as $language => $value ) {

这是什么意思?我用谷歌搜索了一下,this result并没有真正解释它。我查看了 man,我发现的一个例子似乎也没有解释它:

3. It is followed by two-line from-file/to-file header

               --- a/file
               +++ b/file

           Similar to two-line header for traditional unified diff format, /dev/null is used to signal created or deleted files.

这是什么意思?我对文件所做的更改超过了先前版本的 50%。它与文件重写有关吗?这就是我提交时发生的情况。

最佳答案

这些行是自上一个版本以来添加的。

来自手册页:

- static void describe(char *arg)
 -static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)

In the above example output, the function signature was changed from both files (hence two - removals from both file1 and file2, plus ++ to mean one line that was added does not appear in either file1 nor file2). Also eight other lines are the same from file1 but do not appear in file2 (hence prefixed with {plus}).

参见 diff 手册:

https://www.kernel.org/pub/software/scm/git/docs/v1.7.3/git-diff.html

关于git - git diff 中的两个加号是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29774466/

相关文章:

Git:从工作树中删除已删除的文件

linux - Linux 共享开发中如何保证代码安全?

git - 通过 git 跟踪工作时间

git - 你多久在 Git 中标记一次?

git - 从 GitHub 中删除代码

Git 克隆错误 "HTTP code 504 from proxy after CONNECT"

git - 如何使用 git 有效更新项目文件?

git - 提交的 SHA-1 是否仅根据树的内容计算?

git - 为什么 hudson / Jenkins 试图做出 promise ?

javascript - 如何将 .prettierignore 文件基于 .gitignore