SVN迁移到GIT后续推送

来源:互联网 发布:c语言能够做什么 编辑:程序博客网 时间:2024/06/05 05:59

SVN迁到GIT

git svn init xxx
外加

git svn fetch

迁完后,考虑到某些时间 svn会继续更新,这时怎么同步呢?

先打开.git/config文件,可以看到:

[svn-remote "svn"]url = https://xxxxfetch = :refs/remotes/git-svn
也就是remotes/git-svn对应的就是git clone迁移时候的svn仓库

$ git show-refec1aab5d3a45537898a5851c843d90036aadd62e refs/heads/master58e66ad715e9f104d2455e5aeeb9b6dd415973f9 refs/remotes/git-svn8b6bf396ba7567dc777f30bc7769ce804f96aa4f refs/remotes/masterec1aab5d3a45537898a5851c843d90036aadd62e refs/remotes/origin/master

1.取远程分支并分化一个新分支local-git-svn 然后同步svn的提交记录,

$ git checkout -b local-git-svn remotes/git-svnSwitched to a new branch 'local-git-svn'

  

2.然后同步svn最新提交记录

git svn fetch

  

3.切换回master分支,并执行合并

git checkout mastergit merge local-git-svn

  

4.推送到远端的master

 git push origin master

  

5.最后把local-git-svn分支可以删除了

git branch -d local-git-svn


===》前面有点复杂了,可以简化为三步:

git svn fetch
git merge remotes/git-svn
git push origin master










原创粉丝点击