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

git-svn and rebasing refactored (moved) content

From
Halstrick, Christian <christian.halstrick@sap.com>
Date
Sep 15, 2009, 16:11 UTC
Message-ID
<D35B4A582834DC418CCF9AF41AB69B70014954E265@DEWDFECCR04.wdf.sap.corp>
In-Reply-To
<1252699129-6961-3-git-send-email-spearce@spearce.org>
Hi,

I have a question regarding git rebase operation when content was moved. I have the problem when I transfer stuff from a subversion repo into my git repo, but I wouldn't know the solution even if it would be a pure git scenario. Here is the problem:

There is a SVN repository "Source" containing that files "Source": project/feat1/A.java project/feat1/B.java project/C.java

There is git repository "Target" where I work. That repository get's updates from "Source" by 'git-svn migrate ...'. I had to move the files coming from "Source" (using 'git mv'). I just moved but did not (and will not in future) modify the files of "Source". Additionally I added my own new files. The state of target is: "Target": project/src/feat1/A.java (renamed file) project/src/feat1/B.java (renamed file) project/src/C.java (renamed file) project/pom.xml (created file)

Ideally from time to time I would like to rebase my work I do in "Target" on the latest state of "Source". I use "git rebase ..." for that. But this sometimes fails. If in "Source" files are only modified everything works fine. E.g. modifications to "Source":project/feat1/A.java are visible in "Target":project/src/feat1/A.java. That's great!

But the rebase fails with conflicts when things are moved or deleted in "Source". E.g. if "Source":project/feat1/A.java becomes "Source":project/feat2/A.java and I merge that commit into my branch in "Target" I get

> CONFLICT (rename/rename): Rename
> "project/feat1/A.java"->"project/feat2/A.java" in branch "HEAD" rename
> "project/feat1/A.java"->"project/src/feat1/A.java " ...

I do understand the conflict but I am asking whether there is a better way to use git so that I can get around these merge problems.

Ciao
  Chris
Previous: Shawn O. Pearce
Message 4 of 4 in “Disallow creating invalid DirCacheEntry records”
  1. 1/3 Disallow creating invalid DirCacheEntry recordsShawn O. Pearce, Sep 11, 2009
  2. 2/3 Don't allow DirCacheEntry with mode of 0Shawn O. Pearce, Sep 11, 2009
  3. 3/3 Use keep(1) instead of add() when skipping an entryShawn O. Pearce, Sep 11, 2009
  4. git-svn and rebasing refactored (moved) contentHalstrick, Christian, Sep 15, 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.