0

我希望能够调用git diff [something] <commit0>..<commit1>并获取自提交 0 以来已修改的提交 1 中的文件名和行号。目前,如果我有

# foo.txt
foo

bar

并更改 '\nbar\n' -> 'baz',我明白了

diff --git a/foo.txt b/foo.txt
index 29a4dcd7..28932e58 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1,5 +1,4 @@
 # foo.txt
 foo
-
-bar
+baz

如何指示 git diff 隔离新版本的第 2 行(1-indexed)foo.txt已修改?是否可以不跳入脚本语言?

4

0 回答 0