例如在 git diff
diff --git a/commands.txt b/commands.txt
index 79e881a..a9588e5 100644
--- a/commands.txt
+++ b/commands.txt
@@ -1,3 +1,7 @@
+this is an example
+abcxyz
+helllo
+wooo
makeFilePermissionExecutable
makeOwnedByMyself
makeFilePermissionEverything
是否可以 stash 以下内容:
diff --git a/commands.txt b/commands.txt
index 79e881a..a9588e5 100644
--- a/commands.txt
+++ b/commands.txt
而是只显示文件名(在本例中为 commands.txt)?
最佳答案
git 差异 | tail -n +5
将产生您想要的输出。
我们将 git diff
的输出通过管道传输到 tail -n +5
以在第 5 行开始输出。参见 man
页面 尾-n
:
-n, --lines=[+]NUM
output the last NUM lines, instead of the last 10; or use -n
+NUM to output starting with line NUM
如果您想要 merge --- a/commands.txt
和 +++ b/commands.txt
,您将不得不做一些额外的正则表达式工作> 到单行。
关于git - 如何排除带有 "git diff"的补丁 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47496283/