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

git mv + git pull issue

From
CDChristoph Duelli <duelli@melosgmbh.de>
Date
Jun 6, 2008, 07:57 UTC
Message-ID
<4848EDDF.7090906@melosgmbh.de>

"git mv" followed by a git pull (before commiting) the move, loses the "remove" part of the move. This can lead to dupes in the repository.

Consider the following steps:

# create a new repo with a file in it mkdir gitmv cd gitmv/ git init touch afile git add afile git commit -a -m"first"

# clone it cd .. git clone gitmv/ gitmv-clone cd gitmv-clone/ touch other git add other git commit -a -m"other"

cd ../gitmv git mv afile newname # do not commit # now: afile is not in the directory anymore # oh, I need those changes my colleague made... git pull ../gitmv-clone/ # now: both(!) afile and newname are in the directory

If I commit now (and overlook this) I will have 2 copies of this file in my repository which is not usually what I want.

Suggestion:
+ if the file was not touched in the pulled commits, leave it (missing)
+ if it was touched: this should be a conflict
Best regards
-- 
Christoph Duelli
Next: Johannes Schindelin
Message 1 of 3 in “git mv + git pull issue”
  1. Christoph DuelliJun 6, 2008
  2. Johannes SchindelinJun 6, 2008
  3. Christoph DuelliJun 9, 2008

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.