实在是受不了公司的 svn 了,最近尝试从 svn 切换到 git ,总结了一下常用的命令。如果总结的有误,烦请指正。 第一次使用从 svn 获取代码
git svn clone svn://svn.svnbucket.com/xxxx/demo/trunk/
从 svn 获取更新
git svn rebase
提交代码到本地 git 仓库
git add .
git commit -m "update"
提交到 svn
git svn dcommit
如何解决冲突
git svn rebase 从 svn 获取代码遇到冲突后,
解决冲突的代码
然后
git add .
git commit -m "update"
git rebase --continue
最后 git svn dcommit 提交到 svn
如果执行 git svn rebase 报错,按照下面的步骤就可以获取更新了 (进行 git rebase 操作时,通常不允许有未保存的修改( unstaged/uncommitted changes ))
git stash //暂存
git svn rebase //更新
git stash pop // 暂存
要在 IntelliJ IDEA 中实现自动执行 git svn dcommit 和 git svn rebase 的功能,参考这个帖子 https://v2ex.com/t/1068059