Home > git > Transfer SVN “Branch” into git branch

Transfer SVN “Branch” into git branch

There are easier ways to do this, but if you cannot use git-svn for whatever reason you can follow these directions.

  1. Start at the trunk level of your svn checkout and initialize git:
    git init
  2. Then exclude the subversion folders, by adding the following line to “.git/info/exclude”:
    .svn
    *.pyc
  3. Commit all the code:
    git add .
    git commit -m "Initial import of trunk"
  4. Create branch and move into branch:
    git checkout -b svn_branch
  5. Now merge the subversion changes into this git branch (check out this short post). So what’s actually happening is since your in the git “svn_branch” checkout it will add all your merge changes to that git branch.
    svn merge -r <branch copy rev>:HEAD http://<repo_url>/branches/<name of branch>
  6. At this point check to see if subversion did any merges. Add and commit the changes to the git branch:
    git add .
    git commit -a -m "Import of svn branch"
Categories: git Tags:
  1. No comments yet.
  1. No trackbacks yet.