[英]git-svn: how do I create a new svn branch via git?
我有一個跟蹤svn存儲庫的git存儲庫。 我使用--stdlayout
克隆它。
我通過git checkout -b foobar
創建了一個新的本地分支
現在我希望這個分支最終在svn存儲庫中的…/branches/foobar
中。
我該怎么做?
(剪了很多調查文本。如果你關心,請查看問題歷史)
我知道這個問題已經回答了一段時間,但在閱讀之后,我可能會幫助添加特定git svn分支命令的示例並將其與典型的工作流程聯系起來。
像kch一樣回答,使用git svn branch
。 這是一個完整的例子,(注意-n
用於干運行測試):
git svn branch -n -m "Branch for authentication bug" auth_bug
如果這很順利,服務器會回答這樣的答案:
復制https://scm-server.com/svn/portal/trunk在r8914到https://scm-server.com/svn/portal/branches/auth_bug ...
如果沒有-n
開關,服務器可能會添加如下內容:
找到可能的分支點: https : //scm-server.com/svn/portal/trunk => https://scm-server.com/portal/branches/auth_bug,8914
找到分支父母:(refs / remotes / auth_bug)
d731b1fa028d30d685fe260f5bb912cbf59e1971
以下是do_switch的父級
成功跟隨父母r8915 = 6ed10c57afcec62e9077fbeed74a326eaa4863b8
(參考文獻/遙控器/ auth_bug)
最好的部分,現在你可以根據你的遠程分支創建一個本地分支,如下所示:
git checkout -b local/auth_bug auth_bug
這意味着“檢查並創建名為auth_bug
本地分支,並使其跟隨遠程分支(最后一個參數) auth_bug
測試您的本地分行通過使用適用於遠程分支dcommit
與--dry-run
( -n
):
git svn dcommit -n
SVN服務器應該回復新的分支名稱:
從git v1.6.1開始, git svn branch
可用。
從git文檔:
branch Create a branch in the SVN repository. -m, --message Allows to specify the commit message. -t, --tag Create a tag by using the tags_subdir instead of the branches_subdir specified during git svn init.
以前版本的git不提供創建svn分支的方法。
@kch我只是(2008年12月7日)編譯了git的v1.6.1-rc1標簽,它確實包含了git svn branch命令及其文檔。 所以git的v1.6.1版本應該(希望)包含這個命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.