git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff Epler <jepler@unpythonic.net>
Date
May 24, 2010, 13:58 UTC
Message-ID
<20100524135823.GC19861@unpythonic.net>

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
Next: Jeff King
Message 1 of 3 in “'git pull --dry-run' accepted, but moves HEAD and changes working tree”
  1. Jeff EplerMay 24, 2010
  2. Jeff KingMay 25, 2010
  3. Junio C HamanoMay 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.