Search code examples
gitcommitrevertgit-filter-branch

How to revert a 'git filter-branch -f --env-filter'


I am quite a newb regarding git and usually git commit, pull and push are the only commands I do. Recently noticed that my commits were set to a default name and email and wanted to change it. Stupidly I ran this which I found in a post somewhere:

git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Newname'; GIT_AUTHOR_EMAIL='newemail'; 
GIT_COMMITER_NAME='Newname'; GIT_COMMITTER_EMAIL='newemail';" HEAD

I thought this would change only my commits, but instead it changed all commits in the repo to have my name and email. Of course to continue my "dumbness" I pushed the changes.

Also I seem to have lost history and all commits on github seem to have a duplicate entry as well. One with my name and email and the original one.

Is there a way to revert this? Maybe using a copy of a previous pull to push the original info?


Solution

  • A colleague was able to speak with some git pros and it seems that a 'git push -f' from a previous copy solved the issue. Also, I needed to do a git pull --rebase on my copy.

    Thanks for your help guys.