0%

git note

通用

使用git作为svn的版本管理工具

从svn地址获取clone仓库

使用 git clone [svn仓库地址]
ps:如果不需要把svn所有文件修改记录down下来可以添加-r HEAD 参数再最后面,这样可以只clone下来最新的文件

获取更新

使用 git svn fetch

合并远程分支代码到本地分枝

使用 git svn rebase
ps: 其实当使用这个命令的时候git会自动从svn取下当前最新代码并合并到当前本地分支,所以无特殊情况使用此命令即可

提交代码到svn

使用git svn dcommit
此命令会将本地所有提交一一提交到svn仓库,所以提交前最好先整理下本地提交

常见问题

切换svn地址

参考链接

  • Edit the svn-remote url URL in .git/config to point to the new domain name
  • Run git svn fetch - This needs to fetch at least one new revision from svn!
  • Change svn-remote url back to the original url
  • Run git svn rebase -l to do a local rebase (with the changes that came in with the last fetch operation)
  • Change svn-remote url back to the new url
  • Run git svn rebase should now work again!