所有的git命令都有一个干运行选项吗? [英] Do all git commands have a dry-run option?
问题描述
- git merge has
不是所有的命令都会直接支持空运行。 /www.commandlinefu.com/commands/view/386/git-merge-dry-runrel =noreferrer>自己的选项
(git merge --no-commit - no-ff
) - 但 git pull并不需要它('
git fetch origin
',然后a
'git log master..origin / master
',在git merge origin / master
之前)
(但git push
有一个空运行选项)
有些东西在git中没有实现,因为它们没有使
有意义,有一些东西在git中没有实现,因为没有
的东西可以搔痒。
换句话说,我们倾向于只实现
的东西,这些东西存在实际的需求对于真实世界和
而言,只有当增加作为系统的连贯部分才有意义。
iboisver 评论:
另外需要注意的是,像
git add
和git rm
允许-n
命令行选项指定空运行,而在 -n $ git commit c $ c>选项意味着完全不同的东西。
所以一定要检查手册页
git commit -n
:
-n
--no-验证
此选项绕过预先提交和提交msg挂钩。另请参阅 githooks(5)。
Do all git commands have a --dry-run option, or one which would indicate what the command would do without actually doing them?
Not every command would naturally support a dry run directly.
- git merge has its own option (
git merge --no-commit --no-ff
) - but git pull does not really need it ('
git fetch origin
', then a 'git log master..origin/master
', before agit merge origin/master
)
(butgit push
has a dry-run option)
There are things that are not implemented in git because they do not make sense, and there are things that are not implemented in git because nobody had itch to scratch for.
To put it differently, we tend to implement only things that there are actual, demonstrated needs for from real world and only when the addition makes sense as a coherent part of the system.
iboisver comments:
Another thing to be aware of is that commands like
git add
andgit rm
allow the-n
command-line option to specify dry run, while ingit commit
, the-n
option means something completely different.
So be sure to check the man page
git commit -n
:
-n
--no-verify
This option bypasses the pre-commit and commit-msg hooks. See also githooks(5).
这篇关于所有的git命令都有一个干运行选项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!