I used filter-branch to fix an incorrect email address in my repository but all the branches are now MIA (except master).
This is what git graph
showed prior to filter-branch
:
* d93c7ee (HEAD, master) Merge branch 'f1'
|\
| * 08e7463 (f1) adding b
|/
* 7c7bd91 adding a
I issued this filter-branch command:
git filter-branch --env-filter 'export GIT_AUTHOR_EMAIL="fixed-email";
GIT_AUTHOR_NAME="fixed-author"'
And got this:
* 770262a (HEAD, master) Merge branch 'f1'
|\
| * 0f58ab5 adding b
|/
* fb012a9 adding a
* d93c7ee (refs/original/refs/heads/master) Merge branch 'f1'
|\
| * 08e7463 (f1) adding b
|/
* 7c7bd91 adding a
A few things that bother me:
1) f1
branch wasn't moved to 0f58ab5.
2) All commits before fb012a9 seem irrelevant to me, can I get rid of them?
I saw in another question someone suggesting to:
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now
But it didn't quite help, this is what I got afterwards:
* 770262a (HEAD, master) Merge branch 'f1'
|\
| * 0f58ab5 adding b
|/
* fb012a9 adding a
* 08e7463 (f1) adding b
* 7c7bd91 adding a
EDIT: doing what VonC had suggested yielded this graph:
* 211632d (HEAD, master) Merge branch 'f1'
|\
| * bda7577 (f1) adding b
|/
* 70c7b34 adding a
* 3182b33 (refs/original/refs/heads/master) Merge branch 'f1'
|\
| * 8b81c21 (refs/original/refs/heads/f1) adding b
|/
* 4c07dc9 adding a
Which solved problem #1, now I only need to find a way to get rid of the old commits, how do I accomplish that?