0

我们正在进行从 cvs/bugzilla 到 git/Stash/Jira 的转换。我正在测试使用git filter-branchjira 问题 ID 重写提交消息中的 bugzilla bug #s。这有效,除了它只影响主而不影响任何分支。我使用-- --all但没有签出任何分支。那有必要吗?确切的命令如下:

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

注意 - gitBugzillatoJira.shruby​​ 脚本负责将 bugzilla 编号交换为 Jira 问题 ID。

有任何想法吗?

4

2 回答 2

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运行中得到什么输出?

于 2013-08-21T13:34:39.267 回答
0

User Error!

Like the image says, it was case of user error! After getting 3rd party confirmation my git-filter-branch should work I realized I only had done git push so only locally checked out branches were pushed. Looks like I should git push --all to update all refs. Now, I need to figure out why I'm getting 3 references to master along with my other branches:

* [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
于 2013-08-22T01:54:06.500 回答