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

Re: Merge after directory rename ?

From
Michael Witten <mfwitten@gmail.com>
Date
Aug 22, 2011, 02:19 UTC
Message-ID
<CAMOZ1Bsb7UxYOFpRWh47+130upfD9_E=CMQtZd1NyUWPwWiW4A@mail.gmail.com>
In-Reply-To
<j2s83l$eqg$1@dough.gmane.org>
2011/8/22 Marcin Wiśnicki <mwisnicki@gmail.com>:
Show 27 quoted lines
> On Sun, 21 Aug 2011 23:53:34 +0000, Michael Witten wrote:
>> Importantly, note that I used only file names in my example,
>> specifically:
>>
>>   5. [master]  rename dir1/file3 to dir3/file3
>>
>> rather than mirroring your example by writing:
>>
>>   5. [master]  rename dir1 to dir3
>>
>> This is because git fundamentally tracks content, and paths are just one
>> kind of content associated with another blob of content. Consequently,
>
> I know it tracks content, yet it puts effort to detect file renames.
> I want it to also detect directory renames, detecting it should be quite
> easy.
>
>> git really knows next to nothing about directories, so it's not too
>> surprising that git doesn't bother finding such a DIRECTORY rename
>> anyway (at most, git would detect a FILE rename, and your FILE
>> `dir1/file2' has nothing to do with, say, the FILE `dir1/file1' being
>> renamed `dir2/file1').
>>
>> Still, some command line switches could be useful to help the user
>> express to git what should be going on in a case such as yours.
>
> I would prefer it to be fully automatic :)

I assume the smiley is tongue-in-cheek; however, in case it is not: It can't be automatic in general; did my examples mean nothing?

> Or at least detect/warn about tree conflict.
Did my examples mean nothing?
> Directory renames can happen quite frequently when working with Java/C#
> and it is unreasonable to expect that lazy user will have to keep track of
> it manually (with huge number of files it's impossible).
Git doesn't know anything about Java/C#; that's the point.

In general, the user could make use of switches (as suggested). In particular, perhaps there are merge hooks or merge drivers that could be used or implemented for allowing a more environment-specific handling of merges, a la GNU's ChangeLog merge driver:

  http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c

Also, see the configuration section of `git help merge'. Also look at the tool `git mergetool'.

Previous: Marcin WiśnickiNext: Marcin Wiśnicki
Message 5 of 8 in “Merge after directory rename ?”
  1. Marcin WiśnickiAug 21, 2011
  2. Michael WittenAug 21, 2011
  3. Michael WittenAug 21, 2011
  4. Marcin WiśnickiAug 22, 2011
  5. Michael WittenAug 22, 2011
  6. Marcin WiśnickiAug 22, 2011
  7. Michael WittenAug 23, 2011
  8. Jeff KingAug 23, 2011

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.