{"thread":{"id":"13828","subject":"git mv + git pull issue","startedAt":"2008-06-06T07:57:19Z","lastAt":"2008-06-09T08:45:12Z","messageCount":3,"participants":["Christoph Duelli","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"78878","messageId":"4848EDDF.7090906@melosgmbh.de","threadId":"13828","inReplyTo":null,"subject":"git mv + git pull issue","fromName":"Christoph Duelli","fromEmail":"duelli@melosgmbh.de","sentAt":"2008-06-06T07:57:19Z","receivedAt":"2008-06-06T07:57:19Z","isPatch":false,"sender":{"key":"duelli@melosgmbh.de","avatar":null},"body":"\"git mv\" followed by a git pull (before commiting) the move, loses the \n\"remove\" part of the move. This can lead to dupes in the repository.\n\n\nConsider the following steps:\n\n# create a new repo with a file in it\nmkdir gitmv\ncd gitmv/\ngit init\ntouch afile\ngit add afile\ngit commit -a -m\"first\"\n\n# clone it\ncd ..\ngit clone gitmv/ gitmv-clone\ncd gitmv-clone/\ntouch other\ngit add other\ngit commit -a -m\"other\"\n\ncd ../gitmv\ngit mv afile newname\n# do not commit\n# now: afile is not in the directory anymore\n# oh, I need those changes my colleague made...\ngit pull ../gitmv-clone/\n# now: both(!) afile and newname are in the directory\n\nIf I commit now (and overlook this) I will have 2 copies of this file in \nmy repository which is not usually what I want.\n\n\nSuggestion:\n+ if the file was not touched in the pulled commits, leave it (missing)\n+ if it was touched: this should be a conflict\n\nBest regards\n-- \nChristoph Duelli\n"},{"id":"78922","messageId":"alpine.DEB.1.00.0806061639390.1783@racer","threadId":"13828","inReplyTo":"4848EDDF.7090906@melosgmbh.de","subject":"Re: git mv + git pull issue","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-06T15:40:28Z","receivedAt":"2008-06-06T15:40:28Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 6 Jun 2008, Christoph Duelli wrote:\n\n> cd ../gitmv\n> git mv afile newname\n> # do not commit\n> # now: afile is not in the directory anymore\n> # oh, I need those changes my colleague made...\n> git pull ../gitmv-clone/\n> # now: both(!) afile and newname are in the directory\n\nWhat is so surprising there?  We _always_ recommend to commit before \npulling.\n\nCiao,\nDscho\n"},{"id":"79213","messageId":"484CED98.3070506@melosgmbh.de","threadId":"13828","inReplyTo":"alpine.DEB.1.00.0806061639390.1783@racer","subject":"Re: git mv + git pull issue","fromName":"Christoph Duelli","fromEmail":"duelli@melosgmbh.de","sentAt":"2008-06-09T08:45:12Z","receivedAt":"2008-06-09T08:45:12Z","isPatch":false,"sender":{"key":"duelli@melosgmbh.de","avatar":null},"body":"Johannes Schindelin schrieb:\n> Hi,\n> \n> On Fri, 6 Jun 2008, Christoph Duelli wrote:\n> \n>> cd ../gitmv\n>> git mv afile newname\n>> # do not commit\n>> # now: afile is not in the directory anymore\n>> # oh, I need those changes my colleague made...\n>> git pull ../gitmv-clone/\n>> # now: both(!) afile and newname are in the directory\n> \n> What is so surprising there?  We _always_ recommend to commit before \n> pulling.\nWell, when I modify a file, and pull afterwards: my 'modification' is \nnever lost (the pull might fail, though).\nIf we consider the removal of a file as a kind of modification, one \nwould expect a similar behaviour.\n\nI do agree that this is not (nec.) a bug, still I thought it worthwhile \nto bring the matter up.\nIn our repository we get duplicates now and then because of it.\n\nRegards\n-- \nChristoph Duelli\n"}]}