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.
- Start at the trunk level of your svn checkout and initialize git:
git init
- Then exclude the subversion folders, by adding the following line to “.git/info/exclude”:
.svn
*.pyc
- Commit all the code:
git add .
git commit -m "Initial import of trunk" - Create branch and move into branch:
git checkout -b svn_branch
- 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>
- 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