Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6029669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:55:15+00:00 2026-05-23T04:55:15+00:00

I recently used git svn branch to create a branch (in both Subversion and

  • 0

I recently used git svn branch to create a branch (in both Subversion and git).

I noticed that (for some reason I’m not sure about; maybe a bug or maybe I created the branch incorrectly?) the git commit for the branch creation has two parents: one at the top of the tree at the time I created the branch (incorrect since I branched from a previous revision) and one at the (expected) previous revision.

This “second parent” causes all kinds of grief for me, since I’m now trying to merge from another branch to the new branch, and git’s idea of the common ancestor is incorrect.

I found this question which explains how to force the git branch to have the correct parent by using a rebase. The problem is, the rebase only affected my local branch HEAD, not the remote tied to the git-svn repository. Normally, this would be a very bad thing, but since I’m the only one using this git-svn repository, I don’t care: I just want to move the remote branch to the adjusted commit now.

So my question is: now that I’ve got the parent for the local branch pointed at the correct commit it branched from, is there a way for me to move the remote branch to the same HEAD, so that I can (for example) run git svn rebase without it getting confused? (I’m afraid that if I change it by hand, the .git/refs/remotes/<mybranch>/.rev_map... file won’t match up with SVN any more…?)


Edit: To address the question posed in the comment, yes, the branch is checked out. I’m going to change the names of my branches to protect the innocent, but let’s imagine it looks like this:

$ git branch
* git_mysvnbranch
  git_releasebranch
  master

$ git branch -r
  trunk
  mysvnbranch
  releasebranch

Now, when I created the branch, mysvnbranch had a parent of both trunk, and the arbitrary point off of trunk that I branched from. Now I want to take releasebranch and merge it into mysvnbranch, which is when I see a problem. If I launch gitk it looks like this:

o [git_mysvnbranch] [remotes/mysvnbranch]
|\ <--- bad pointer here
| o [remotes/trunk]
| |
| o 
| | o [git_releasebranch] [remotes/releasebranch]
| | |
| o o
| |/
| o
| |
| o
| |
| o
|/
o [arbitrary branch point]

So you can see the problem if I want to merge in [remotes/releasebranch]. If I do a rebase, I can make it look like this:

o [git_mysvnbranch]
|
| o [remotes/mysvnbranch]
| |\ <--- bad pointer here
| | o [master] [remotes/trunk]
| | |
| | o 
| | | o [git_releasebranch] [remotes/releasebranch]
| | | |
| | o o
| | |/
| | o
| | |
| | o
| | |
| | o
| |/
|/
o [arbitrary branch point]

And now I want to git rid of the version of [remotes/mysvnbranch] with the bad parent, and make it point to where [git_mysvnbranch] points to instead.

But here’s a curious thing that I just found out: the svn metadata might indeed be intact. I just did this:

$ git svn rebase -n
Remote Branch: refs/remotes/mysvnbranch
SVN URL: svn://subversionrepo/branches/mysvnbranch

So maybe I’m worrying about nothing. I will test this a little more to try to find out.


Edit 2: I’m not worrying about nothing. As soon as I tried git svn rebase from the rebased branch, it tried to re-merge changes that had already been merged into the git branch.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:55:16+00:00Added an answer on May 23, 2026 at 4:55 am

    After much pain and suffering, I have found a workaround, but it’s not a very good one:

    $ svn copy -r <arbitrary-branch-point> svn://subversionrepo/trunk \ 
                                           svn://subversionrepo/branches/mysvnbranch2
    

    That is, I gave up and recreated the branch with a different name. (using the Subversion client, just to be safe.) Then I did a git svn fetch --all. I think I’ll be able to rebase my work onto the new branch and call it a day. When I check gitk, the new branch is based on the proper revision.

    I hope someone knows of a better workaround, because I don’t think this would be acceptable to everyone who has this same problem.

    FYI, I think this happened because a branch with the same name was created incorrectly and then deleted, before I started on this. This probably confused git-svn.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a menu that contains, among other things, some most-recently-used file paths. The
I recently used git-svn to clone an SVN repository, for the purposes of maintaining
I've recently used git svn and enjoyed it very much. Now I'm starting a
I'm relatively new to git, having used Subversion primarily in the past. I recently
Recently I used a class that inherits from a collection instead of having the
The code below shows a sample that I've used recently to explain the different
I used an application recently that was awe-inspiring. All the forms inherited from their
Background: Recently while looking at a structured text editor I noticed they used a
I've not used C++ very much in the past, and have recently been doing
Some friends of mine and I were talking recently about version control, and how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.