git svn workflow
Upcoming SlideShare
Loading in...5
×
 

git svn workflow

on

  • 2,695 views

 

Statistics

Views

Total Views
2,695
Views on SlideShare
2,644
Embed Views
51

Actions

Likes
2
Downloads
29
Comments
0

2 Embeds 51

http://yinhm.appspot.com 50
http://cncc.bingj.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

git svn workflow git svn workflow Presentation Transcript

  • SVN Git 工作流程
    • 开始前
    • 团队正在使用subversion
    • 无法完全转换到git(SCM支持,部署等)
    • 希望离线开发、本地提交支持
    • Repositories
    • SVN:唯一的仓库地址
    • GIT:每个工作拷贝(Working copy)有自己的仓库,保存在每个项目根目录下.git子目录
  • URL
    • SVN:约定路径,常见 trunk/, branches/, tags/ 目录
    • GIT:内置branches, tags,默认master分支
  • SVN工作流程:特性分支
    • 创建:
    • Hack, hack, hack...commit
    • 同步trunk更新
    • 每日同步trunk
      svn log –stop-on-copy (|egrep -i 'synced|merged') svn merge -r 3233:5423 https://dev/trunk svn ci -m "Synced in changed from trunk: re merged in revs 3233:5423"
      svn cp https://dev/trunk https://dev/branches/coolstuff
  • SVN工作流程(特性分支)
      merge回trunk
    svn switch https://dev/trunk svn up At revision 138. svn merge https://dev/branches/coolstuff@138 https://dev/trunk@138
  • Clone SVN
      git svn clone -s https://dev/ foo
  • 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
  • Git svn流程: BUG修正
      如果trunk有更新!
    [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
  • 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
  • Git svn流程: 特性分支
      Merge back to master
    [dev] $ git checkout master # 将dev的多个commits 作为一个commit提交 [master] $ git merge --squash dev [master] $ git svn rebase [master] $ git svn dcommit
    • Git & git-svn manpages
    • Git - SVN Crash Course : http://git.or.cz/course/svn.html
    • Agavi Developer Info : http://trac.agavi.org/wiki/Deprecated/General/DeveloperInfo
    • Git docs: http://git-scm.com/documentation
    • Pro Git: http://progit.org/