浏览brackets-git的源代码(一款Brackets的git扩展),我发现在调用git diff
时,会将^!
(caret bang)附加到提交哈希值上。请参见GitCli.js,第754行:
function getDiffOfFileFromCommit(hash, file) {
return git(["diff", "--no-ext-diff", "--no-color", hash + "^!", "--", file]);
}
这在命令行中的翻译如下,以所讨论的文件为例:
$ git diff --no-ext-diff --no-color 1f9ea6e^! -- src/git/GitCli.js
我知道
^
代表该提交的父提交。那么 ^!
是什么意思?