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?
If you haven't done anything to clean up loose objects after you did the filter-branch command, you can reset your master branch (assuming HEAD was master when you gave the command):
git reset --hard refs/original/master
If you didn't cleanup yet you can reset your branch with : git reset --hard refs/original/master
this will reload all the original files prior to your attempt then do:
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Newname'; GIT_AUTHOR_EMAIL='newemail'; GIT_COMMITER_NAME='Newname'; GIT_COMMITTER_EMAIL='newemail';" "--tag-name-filter cat -- --all"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With