Do all git commands have a dry run option?

Do all git commands have the -dry-run option, or does one of them indicate what the command could do without executing them?

+52
git
Apr 04 '10 at 8:22
source share
2 answers

Not every team will naturally maintain a dry run directly.

  • git merge has its own variant ( git merge --no-commit --no-ff )
  • but git pull really is not needed (' git fetch origin ', then ' git log master..origin/master ', before a git merge origin/master )
    (but git push has the option of dry running)

How JC Hamano summarizes :

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 no one had an itch to scratch.
In other words, we strive to realize only things that are real, demonstrated needs from the real world and only when the addition makes sense as a coherent part of the system.




iboisver comments:

Another thing you need to know about is commands like git add and git rm that allow you to use the -n command line option to specify a dry run , and in git 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) .

+53
Apr 04 '10 at 9:45 a.m.
source share

Although the --dry-run flag is not always available for each comment, equivalents usually exist. For example, this previous question shows what to do for git merge .

+8
Apr 04 '10 at 8:32
source share



All Articles