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 8757381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:17:17+00:00 2026-06-13T14:17:17+00:00

I used git svn to import an existing Subversion repo into git. I then

  • 0

I used git svn to import an existing Subversion repo into git. I then pushed this to git repo on a git server. Over the last few months changes to the software have been made in both Subversion and git repositories. Unfortunately, my local copy with the links between svn and git has been deleted.

I’ve tried to recreate the local copy using git svn again, but when I do a pull from the git server it complains warning: no common conflicts and I end up merging two separate branches with the same commits at the start. Like this:

F
|\
| \
E  D
|  |
C  C
|  |
B  B
|  |
A  A

How can I get it to treat the svn changes like they happened on a branch from the original repo?

F
|\
| \
E  D
| /
|/
C
|
B
|
A
  • 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-06-13T14:17:18+00:00Added an answer on June 13, 2026 at 2:17 pm

    By default git-svn stores mapping between SVN revisions and Git commits in commit messages. Do you see these git-svn-id lines for older commits in your original Git repository? Here I mean that Git repository hosted on the Git server and not that one you’ve fetched from SVN recently.

    If so, you actually didn’t loose any links and git-svn should be able to restore the necessary data from the history. Though due to some compatibility issues between different versions of git-svn this may be a bit tricky:

    1. Clone your original Git repository:

      $ git clone $GIT_SERVER repo
      $ cd repo
      
    2. Update git-svn configuration in .git/config:

      $ git config svn-remote.svn.url $SVN_URL
      $ git config svn-remote.svn.fetch trunk:refs/remotes/trunk
      $ git config svn-remote.svn.branches branches/*:refs/remotes/*
      $ git config svn-remote.svn.tags tags/*:refs/remotes/tags/*
      
    3. Now you have to update refs/remotes/* refs to the latest commits with git-svn-id line:

      $ git log --first-parent refs/heads/master
      commit d566edf5f77ae0a2f7418c40949757e75ef8e83c
      D
      
      commit 4df9f21346526c6505a954d8310637864710308d
      C
      git-svn-id: $SVN_URL .../trunk@3...
      
      commit 116a6760d3e278aa4d54f5bb22e531d30d731661
      B
      git-svn-id: $SVN_URL .../trunk@2...
      
      commit d8bb201c6fd55ea5e645f2d8a07248593d177910
      A
      git-svn-id: $SVN_URL .../trunk@1...
      

      As you can see commit D does not have git-svn-id line, but commit C has one and that line refers to trunk, so you have to update refs/remotes/trunk to commit C:

      $ git update-ref refs/remotes/trunk 4df9f21346526c6505a954d8310637864710308d
      
    4. If you have many branches and tags, repeat the same steps for them with respect to the mapping we’ve specified above:

      • branches/foo => refs/remotes/foo

      • tags/1.0 => refs/remotes/tags/1.0

    5. The final step is to restore the mapping in .git/svn directory:

      $ git svn fetch
      Migrating from a git-svn v1 layout...
      Data from a previous version of git-svn exists, but
          .git/svn
          (required for this version (X.Y.Z) of git-svn) does not exist.
      Done migrating from a git-svn v1 layout
      Rebuilding .git/svn/refs/remotes/trunk/.rev_map.694389ff-b137-4359-84f9-4d1a25628e89...
      r1 = d8bb201c6fd55ea5e645f2d8a07248593d177910
      r2 = 116a6760d3e278aa4d54f5bb22e531d30d731661
      r3 = 4df9f21346526c6505a954d8310637864710308d
      Done rebuilding .git/svn/refs/remotes/trunk/.rev_map.694389ff-b137-4359-84f9-4d1a25628e89
      

    The last command also fetches new revisions from SVN server. After the command is done you have a git-svn clone of Subversion repository. The history in this repository has diverged, so you have to synchronize changes between SVN and Git repositories as usually:

    $ git svn rebase
    $ git svn dcommit
    

    Hope that helps.

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

Sidebar

Related Questions

I used git svn do commit into my svn repository and the comment contained
I recently used git svn branch to create a branch (in both Subversion and
I used git 1.7.4 for working with large svn repo - it was ok.
I migrated my repository from SVN to git. I used THIS site. Now I
I've recently used git svn and enjoyed it very much. Now I'm starting a
I recently used git-svn to clone an SVN repository, for the purposes of maintaining
I have used GIT for a long time and new to SVN. I couldn't
We have a new git repo that is acrued from a svn repo. The
Ok this is really frustrating me. I'm used to working with SVN, and am
I have a SVN repository and I used: git svn clone <svn url> I

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.