Created
February 10, 2012 04:00
-
-
Save j5ik2o/1786414 to your computer and use it in GitHub Desktop.
git:masterからsvn:trunkに同期する方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 前提:クローンしたgitリポジトリに対してsvnリポジトリを設定して同期を行う。 | |
# 設定ファイルを編集のが手間。 | |
$ git clone ssh://localhsot/repos/app.git app | |
# .git/config にSVNのリポジトリの設定を追加する | |
[svn-remote "svn"] | |
url = http://junichi_kato@svn-server | |
fetch = project/app/trunk:refs/remotes/trunk | |
branches = project/app/branches/*:refs/remotes/* | |
tags = project/app/tags/*:refs/remotes/tags/* | |
-- svn用ブランチでgit:masterの更新をマージする場合 | |
# 最新のリポジトリを取得する | |
app$ git remote update | |
# SVNの情報を取得する | |
app$ git svn fetch svn | |
# svnブランチをtrunkから作成して切り替える | |
app$ git checkout -b svn trunk | |
# masterをブランチにマージする | |
app$ git merge master | |
# SVNにコミットする | |
app$ git svn dcommit | |
# svn用ブランチを破棄する | |
app$ git checkout master | |
app$ git branch -D svn | |
-- git:masterで最新のsvn:trunkにリベースする場合 | |
# masterブランチに切り替え | |
app$ git checkout master | |
# masterの最新を取得する | |
app$ git pull | |
# masterをsvn用ブランチの最新にリベースする | |
app$ git rebase svn | |
# svn用ブランチを破棄する | |
app$ git branch -d svn | |
# SVNにコミットする | |
app$ git svn dcommit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment