Subject: 'git pull --dry-run' accepted, but moves HEAD and changes working tree

From: Jeff Epler <[email-masked]>
Date: Mon, 24 May 2010 08:58:23 -0500

I don't recall why I initially typed it, I was surprised to discover
that 'git pull --dry-run' moves HEAD and modifies the working tree.

Here's an example:
$ git reset --hard HEAD^  # so there's something on origin to merge
HEAD is now at c26a08d fix clearing of mesa components
$ git rev-parse HEAD; git pull --dry-run; git rev-parse HEAD
c26a08d1535a02ec044efd0d1fa50205d2da03fa
Updating c26a08d..41c8ee3
Fast-forward
 docs/man/man9/hostmot2.9                |    7 +++++--
 src/hal/drivers/mesa-hostmot2/stepgen.c |    5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)
41c8ee3e19ffb13cc357375d87940cac4769e029
$ git --version
git version 1.7.1

On IRC, jast points out that 'git pull --dry-run' is not explicitly
documented, but unfortunately it is accepted and then does something
that is really counter to the user's expectations. (I assume it's
passing --dry-run to fetch, which does accept it, but that doesn't
ensure that there's nothing at all to merge)

Maybe 'git pull --dry-run' should just be forbidden, or maybe it could
tell the user whether the result of the pull would be a merge, FF, or no
change.

Jeff