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

Re: Git SVN Rebranching Issue

From
EWEric Wong <normalperson@yhbt.net>
Date
Nov 4, 2008, 08:41 UTC
Message-ID
<20081104084111.GB14405@untitled>
In-Reply-To
<20081103140746.GA5969@mars.cyantechnology.local>
Matt Kern <matt.kern@undue.org> wrote:
Show 21 quoted lines
> I have a git-svn issue which keeps biting me.
> 
> My company uses svn as its primary version control system.  We
> frequently create branches, e.g. /branches/somebranch, by forking the
> trunk to ensure stability over the "somebranch" code.  The problem is
> that we also frequently blow away /branches/somebranch and refork it
> from the trunk.
> 
> git-svn does a good job for most work, but I notice that if you delete
> the "somebranch" branch in svn and then refork it, also in svn, then
> when you git-svn fetch, the git commit at the head of remotes/somebranch
> will have two parents: the first is the previous head of
> remotes/somebranch, and the second is the head of remotes/trunk.  Surely
> only the remotes/trunk parent should be listed?  Any connection with the
> previous remotes/somebranch is an accident of naming.  The real problem
> then comes when you come to look at the history in gitk.  If
> "somebranch" is rebranched many times, the git history starts looking
> pretty complicated, when in fact it should simply be the linear history
> of remotes/trunk up to the branch point followed by a few,
> branch-specific commits.  Is there any way to prevent (or modify) the
> git history to remove the errant parent?
Hi Matt,
Short answer: you can use grafts to remove parents.

It was actually an intentional design decision on my part preserve parents based on branch name. We would eventually otherwise lose history of the now-deleted branches, as reflogs can expire.

To me, it's easier to drop history connections you don't want with grafts than to recover it by refetching.

-- 
Eric Wong
Previous: Matt KernNext: Dmitry Potapov
Message 2 of 9 in “Git SVN Rebranching Issue”
  1. Matt KernNov 3, 2008
  2. Eric WongNov 4, 2008
  3. Dmitry PotapovNov 4, 2008
  4. Sverre RabbelierNov 4, 2008
  5. Matt KernNov 4, 2008
  6. Eric WongNov 5, 2008
  7. Avery PennarunNov 5, 2008
  8. Eric WongNov 6, 2008
  9. Avery PennarunNov 6, 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.