2013-08-21 14 views
0

我們正在從cvs/bugzilla轉換爲git/Stash/Jira。我正在使用git filter-branch來測試使用jira問題ID在提交消息中重寫bugzilla bug #s。這工作除了它隻影響主而不是任何分支。我用-- --all但沒有檢出任何分支。這是必要的嗎?具體的命令如下:在所有分支上創建git-filter-branch

git filter-branch -f --msg-filter 'ruby -S gitBugzillaToJira.sh' --tag-name-filter cat -- --all 

注 - gitBugzillatoJira.sh Ruby腳本做交換的Bugzilla號到JIRA問題ID的工作。

任何想法?

+0

我是BFG的作者,它將在下一版本中提供提交消息重寫。出於興趣,你需要重寫多少個不同的問題ID? –

+0

〜10K的問題。我已閱讀BFG!甚至看到比較BFG(在Pi上)和過濾器分支的視頻。 :-)我沒有更多地看過它,因爲我有過濾器分支工作(或者我想過),現在意識到這個問題... – Scott

+0

@RobertoTyley BFG回收清潔劑中是否包含此功能?我剛剛使用了版本1.12.16,我無法發現允許更改提交消息的選項。 – lenz

回答

1

您的git-filter-branch咒語看起來是正確的,它應該更新您的回購本地副本中的所有參考。

這裏是一個非常相似的演示,這顯示工作正常,符合市場預期:

$ git clone https://github.com/defunkt/github-gem.git 
$ cd github-gem/ 
$ git filter-branch -f --msg-filter 'sed "s/e/E/g"' --tag-name-filter cat -- --all 

...你會看到如下所示的結果回來從git-filter-branch,這表明它的更新所有分支和標籤(無需你對他們做了git checkout):

Rewrite 8ef0c3087d2e5d1f6fe328c06974d787b47df423 (436/436) 
Ref 'refs/heads/master' was rewritten 
Ref 'refs/remotes/origin/master' was rewritten 
Ref 'refs/remotes/origin/fallthrough' was rewritten 
Ref 'refs/remotes/origin/gist' was rewritten 
Ref 'refs/remotes/origin/keithpitt-ruby-1.9-update' was rewritten 
WARNING: Ref 'refs/remotes/origin/master' is unchanged 
Ref 'refs/remotes/origin/organizations' was rewritten 
Ref 'refs/remotes/origin/upload' was rewritten 
Ref 'refs/tags/REL-0.4.2' was rewritten 

你從你的git filter-branch來看,這部分得到什麼輸出?

+0

感謝您的意見。我投你的答案爲有幫助。如下所示,我現在意識到它不是git filter-branch,畢竟這是問題。這是我的git-push咒語! – Scott

0

User Error!

像圖片說的那樣,是用戶錯誤的情況!獲得第三方確認後,我的git-filter-branch應該可以工作,我意識到我只做了git push,所以只有本地簽出的分支才被推送。看起來我應該git push --all更新所有裁判。現在,我需要弄清楚爲什麼我會和其他分支一起獲得3個主引用:

* [new branch]  refs/original/refs/heads/master -> refs/original/refs/heads/master 
* [new branch]  refs/original/refs/remotes/origin/master -> refs/original/refs/remotes/origin/master 
* [new branch]  origin/master -> origin/master 
+0

我應該首先搜索SO。從http://stackoverflow.com/questions/7654822/remove-refs-original-heads-master-from-git-repo-after-filter-branch-tree-filte refs/original/*是備份副本,我閱讀有關refs/heads/master是我的本地主人的頭指針,refs/remotes/origin/master是主分支 – Scott

相關問題