Today I created the Git repository from our SVN repository. Not too hard but need some techniques.
Check out from SVN and push to GIT
-
From your workspace clone the svn trunk using git svn clone git svn clone YourSvnTrunkUrl
-
Add remote git repository for pushing git remote add origin YourGitRepoUrl
-
Push the master (trunk) to remote server git push -u origin master
-
To clone 1 branch from svn. Change the .git/config to [svn-remote “svn”] url = YourSvnUrl fetch = trunk:refs/remotes/git-svn fetch = branches/YourSvnBranch:refs/remotes/YourLocalSvnBranch
-
Fetch branches git svn fetch
-
Create a local branch from SVN branch, then push to remote server git checkout -b YourLocalGitBranch remotes/YourLocalSvnBranch git push origin YourLocalGitBranch:YourBranchInGit
How to use git together with svn then you can check out from SVN then push to Git or vice versa
-
Clone git into local git clone YourGitRepoUrl YourGitGolder
-
Change the .git/config to [svn-remote “svn”] url = YourSvnUrl fetch = trunk:refs/remotes/svn/trunk fetch = branches/YourSvnBranch:refs/remotes/svn/YourBranch
-
fetch from specific svn revision git svn fetch -r YourSVNVersion:HEAD
-
if want to update the branch need to change git to the branch first git checkout YourGitBranch
-
merge svn into git git merge remotes/svn/YourBranch git push
To merge conflict files you can use kdiff
- download [kdiff](http://sourceforge.net/projects/kdiff3/files/kdiff3/)
- set kdiff3 as mergetool git config –global merge.tool kdiff3 git config –global mergetool.kdiff3.cmd “"C:\Program Files\KDiff3\kdiff3" $BASE $LOCAL $REMOTE -o $MERGED"
comments powered by Disqus