本文介绍了如何用"git diff"排除补丁标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,在 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
是否可以隐藏以下内容:
Is it possible to hide the following:
diff --git a/commands.txt b/commands.txt
index 79e881a..a9588e5 100644
--- a/commands.txt
+++ b/commands.txt
相反,而是显示文件名(在这种情况下为commands.txt)?
And instead just show the filename (commands.txt in this case) instead?
推荐答案
git diff |tail -n +5
将产生您想要的输出.
git diff | tail -n +5
will produce the output that you desire.
我们将 git diff
的输出通过管道传输到 tail -n +5
,以开始在第5行输出.code> tail -n :
We pipe the output of git diff
into tail -n +5
to begin output on line 5. See the man
page for tail -n
:
-n, --lines=[+]NUM
output the last NUM lines, instead of the last 10; or use -n
+NUM to output starting with line NUM
如果您要合并 --- a/commands.txt
和 +++ b/commands.txt
一行.
这篇关于如何用"git diff"排除补丁标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!