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

Re: How to commit changes if remote repository changed directory structure?

From
Jeff King <peff@peff.net>
Date
Mar 20, 2009, 06:09 UTC
Message-ID
<20090320060926.GC27008@coredump.intra.peff.net>
In-Reply-To
<22612715.post@talk.nabble.com>
On Thu, Mar 19, 2009 at 06:17:15PM -0700, andholt wrote:
Show 7 quoted lines
> I have a lot of local changes to add, commit, and push. Right now our
> directory structure is 1/2/3. Another developer decided to move everything
> up one level, so used git move to move 3 to 2, and removed 3, so now the
> level is 1/2. However, locally, all of my changes are in 1/2/3. 
> 
> I want to commit my changes and merge them into the new directory structure.
> How would I go about doing that?
First, commit your changes. Then merge the other developer's changes. :)

This is exactly the sort of case that git's rename detection should handle; it should detect that the other side renamed files, and then consider your changes against the newly named files. The only thing it _won't_ handle is new files that you added in 1/2/3. You will have to manually move them to 1/2 as part of the merge (there has been discussion of "detect that this whole directory seems to have had its content moved and automatically move new files", but the patches have not been accepted).

-Peff
Previous: andholtNext: Junio C Hamano
Message 2 of 5 in “How to commit changes if remote repository changed directory structure?”
  1. andholtMar 20, 2009
  2. Jeff KingMar 20, 2009
  3. Junio C HamanoMar 20, 2009
  4. Jeff KingMar 20, 2009
  5. J. Bruce FieldsMar 20, 2009

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.