git - git diff的/a/b前缀是什么原因

标签 git git-diff

我已经使用 Git 多年了,一直想知道为什么 git diff 在修改文件的名称前加上 a/b/。我预计最终会偶然发现一个有用的用例,但直到现在它总是很​​烦人而且毫无帮助。

它有什么用?为什么默认启用此功能?在什么情况下有用?

最佳答案

diff man page 中所述, a/b/ 表示区分源和目标的前缀。

实际上,您有以下选择:

--no-prefix

Do not show any source or destination prefix.

--src-prefix=<prefix>

Show the given source prefix instead of "a/".

--dst-prefix=<prefix>

Show the given destination prefix instead of "b/"


Gringo Suave添加 the comments :

Went with:

git diff --src-prefix="SRC " --dst-prefix="DST " 

to make double-click select and paste work.

关于git - git diff的/a/b前缀是什么原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6764953/

相关文章:

c# - Git pull 请求中显示的未更改文件

node.js - 尽管设置了执行权限,OpenShift Node.js 应用程序的操作 Hook 仍不执行

Git diff 忽略子模块中的 textconv

git - 我如何使用 git diff -G?

git - 显示提交之间的差异

Git diff 跨分支的不同目录

Git rebase - 强制覆盖 merge 冲突

git - Git 将如何 merge 这个?

git - 无法在 VisualStudio 中使用 git 操作 (git-askpass.exe : No such file or directory)

git - 什么 Git 命令将显示仅存在于其提交已完全 merge 到 master 的分支中的内容?