实在是受不了公司的 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
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.