Scott
Scott

Reputation: 303

Make git-filter-branch on all branches

We're doing a conversion from cvs/bugzilla to git/Stash/Jira. I'm testing using git filter-branch to rewrite bugzilla bug #s in the commit messages with jira issue IDs. This works except it only affected master and not any branches. I used -- --all but didn't have any branches checked out. Is that necessary? Exact command follows:

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

Note - The gitBugzillatoJira.sh ruby script does the work to swap bugzilla number to the Jira issue ID.

Any ideas?

Upvotes: 0

Views: 2025

Answers (2)

Scott
Scott

Reputation: 303

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

Upvotes: 0

Roberto Tyley
Roberto Tyley

Reputation: 25304

Your git-filter-branch incantation looks correct, it should be updating all refs that are in the local copy of your repo.

Here's a very similar demo, showing this working correctly, as expected :

$ 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

...you'll see output like this coming back from git-filter-branch, indicating that it's updated all branches and tags (without you having to do a git checkout on them):

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

What output do you get from this part of your git filter-branch run?

Upvotes: 1

Related Questions