Excuse me. The author understands that he is "uh idiot, as it is generally possible, take your hands off the keyboard, do not touch her anymore."

There was a project tracked by git th, flooded on bitbucket (probably it does not matter). At some point I wanted to change the author’s name to a large number of commits. To do this, I used the team from here , without having read the warning. Team:

$ git filter-branch --env-filter ' WRONG_EMAIL="wrong@example.com" NEW_NAME="New Name Value" NEW_EMAIL="correct@example.com" if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ] then export GIT_COMMITTER_NAME="$NEW_NAME" export GIT_COMMITTER_EMAIL="$NEW_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ] then export GIT_AUTHOR_NAME="$NEW_NAME" export GIT_AUTHOR_EMAIL="$NEW_EMAIL" fi ' --tag-name-filter cat -- --branches --tags 

Then the most terrible things that I could do were done, namely: git fetch , git pull , git push .

Now in my beatback every commit is now duplicated (but with a changed name).

Namely, the question is: is it possible to return everything back? I understand that I "rewrote history", but I do not seem to understand that this is very dangerous.

  • Be careful when writing commands in the console =) Write - Dmitriy
  • 2
    I use the same script in git. You had to do git push --force immediately after rewriting the history. Add a question: what does git status and git reflog ? I think that you can do git reset --hard HEAD@{1} + git push --force , but first you better make a copy of the project folder and show the output of the commands. And then you can easily aggravate the situation even more. - AK
  • one
    The commits that are duplicated are absolutely identical? Or do they have different identifiers? - Alexey
  • Write git reflog, look for the hash of your pull a и push a. Then, for example, write git reset --hard a0d3fe6, where --hard a0d3fe6 is the hash of your action to roll back (after execution, you will lose all local changes from this commit). Make a copy of the local repository just in case before doing all this. - Dmitriy
  • @ Alexey, they have different hashes, different authors - Oskar Sharipov

0