git diff 中的 --oneline 有什么作用?
What does --oneline in git diff do?
在我的 回答中,我从问题中保留了一个我不知道的选项,即 --oneline
应用于 git diff
而不是 git log
.但是在 man git-diff
中搜索 oneline
没有给出任何结果。仍然 git diff --oneline
没有错误。
它有什么用?
根据 git-diff documentation, the command shows the changes between commits, commit and working tree, etc. The git-diff-tree command is part of git-diff, it compares two tree objects. This makes it possible to use the option. It is a short form of --pretty=oneline --abbrev-commit
. I also found a comment in the git-log 文档:
The command takes options applicable to the git rev-list command to control what is shown and how, and options applicable to the git diff-* commands to control how the changes each commit introduces are shown.
所以我怀疑它是一个子命令的可能选项,但它对 git-diff 命令没有影响。
git diff --oneline
没什么特别的。碰巧 git log
和 git diff
共享命令行解析器的很大一部分(因为所有 diff
选项也适用于 log
)。因此,git diff
不会抱怨 --oneline
的存在,而只会忽略它。
在我的 --oneline
应用于 git diff
而不是 git log
.但是在 man git-diff
中搜索 oneline
没有给出任何结果。仍然 git diff --oneline
没有错误。
它有什么用?
根据 git-diff documentation, the command shows the changes between commits, commit and working tree, etc. The git-diff-tree command is part of git-diff, it compares two tree objects. This makes it possible to use the option. It is a short form of --pretty=oneline --abbrev-commit
. I also found a comment in the git-log 文档:
The command takes options applicable to the git rev-list command to control what is shown and how, and options applicable to the git diff-* commands to control how the changes each commit introduces are shown.
所以我怀疑它是一个子命令的可能选项,但它对 git-diff 命令没有影响。
git diff --oneline
没什么特别的。碰巧 git log
和 git diff
共享命令行解析器的很大一部分(因为所有 diff
选项也适用于 log
)。因此,git diff
不会抱怨 --oneline
的存在,而只会忽略它。