git svn workflow

2,516 views
2,348 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,516
On SlideShare
0
From Embeds
0
Number of Embeds
53
Actions
Shares
0
Downloads
32
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

git svn workflow

  1. 1. SVN Git 工作流程
  2. 2. <ul>开始前 </ul><ul><li>团队正在使用subversion
  3. 3. 无法完全转换到git(SCM支持,部署等)
  4. 4. 希望离线开发、本地提交支持 </li></ul>
  5. 5. <ul>Repositories </ul><ul><li>SVN:唯一的仓库地址
  6. 6. GIT:每个工作拷贝(Working copy)有自己的仓库,保存在每个项目根目录下.git子目录 </li></ul>
  7. 7. URL <ul><li>SVN:约定路径,常见 trunk/, branches/, tags/ 目录
  8. 8. GIT:内置branches, tags,默认master分支 </li></ul>
  9. 9. SVN工作流程:特性分支 <ul><li>创建:
  10. 10. Hack, hack, hack...commit
  11. 11. 同步trunk更新
  12. 12. 每日同步trunk </li></ul><ul>svn log –stop-on-copy (|egrep -i 'synced|merged') svn merge -r 3233:5423 https://dev/trunk svn ci -m &quot;Synced in changed from trunk: re merged in revs 3233:5423&quot; </ul><ul>svn cp https://dev/trunk https://dev/branches/coolstuff </ul>
  13. 13. SVN工作流程(特性分支) <ul>merge回trunk </ul>svn switch https://dev/trunk svn up At revision 138. svn merge https://dev/branches/coolstuff@138 https://dev/trunk@138
  14. 14. Clone SVN <ul>git svn clone -s https://dev/ foo </ul>
  15. 15. Git svn流程: BUG修正 #检出master分支,对应SVN trunk $git checkout master #SVN HEAD不在trunk时候需要reset [master] $ git reset --hard remotes/trunk #创建新分支(git创建删除分支非常廉价) [master] $ git checkout -b quickfix #hack hack hack... [quickfix] $ git commit [quickfix] $ git svn dcommit [quickfix] $ git checkout master [master] $ git svn fetch [master] $ git svn rebase #同步到其它分支 [master] $ git checkout dev [dev] $ git rebase master [dev] $ git checkout master [dev] $ git branch -d quickfix
  16. 16. Git svn流程: BUG修正 <ul>如果trunk有更新! </ul>[quickfix] $ git svn dcommit ==========> fail [quickfix] $ git checkout master [master] $ git svn rebase [master] $ git svn checkout quickfix # rebase master [quickfix] $ git rebase master # 如果merge失败,需要手工处理冲突,然后: # git add file; git rebase --continue [quickfix] $ git svn dcommit
  17. 17. Git svn流程: 特性分支 #确保包含SVN所有版本并和trunk一致 [master] $ git svn fetch; git svn rebase # 创建 dev 分支 [master] $ git svn branch -m 'branching dev' dev [master] $ git branch --track dev dev [master] $ git checkout dev # hack hack hack... [dev] $ git commit [dev] $ git svn dcommit [dev] $ git svn rebase [dev] $ git checkout master [master] $ git svn reabse [master] $ git checkout dev [dev] $ git rebase master
  18. 18. Git svn流程: 特性分支 <ul>Merge back to master </ul>[dev] $ git checkout master # 将dev的多个commits 作为一个commit提交 [master] $ git merge --squash dev [master] $ git svn rebase [master] $ git svn dcommit
  19. 19. <ul><li>Git & git-svn manpages
  20. 20. Git - SVN Crash Course : http://git.or.cz/course/svn.html
  21. 21. Agavi Developer Info : http://trac.agavi.org/wiki/Deprecated/General/DeveloperInfo
  22. 22. Git docs: http://git-scm.com/documentation
  23. 23. Pro Git: http://progit.org/ </li></ul>

×