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 pushhas a dry-run option)
As J.C. 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 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 addandgit rmallow the-ncommand-line option to specify dry run, while ingit commit, the-noption 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).