"git filter-branch" is successfully used to change the committer / author, but the changes do not reflect on github

I recently replaced the author, committer and his email in all my local commits using the following command:

git filter-branch -f --env-filter ' if [ "$GIT_COMMITTER_NAME" = "oldname" ]; then GIT_COMMITTER_NAME="newname"; GIT_COMMITTER_EMAIL="newaddr"; GIT_AUTHOR_NAME="newname"; GIT_AUTHOR_EMAIL="newaddr"; fi if [ "$GIT_AUTHOR_NAME" = "oldname" ]; then GIT_COMMITTER_NAME="newname"; GIT_COMMITTER_EMAIL="newaddr"; GIT_AUTHOR_NAME="newname"; GIT_AUTHOR_EMAIL="newaddr"; fi ' -- --all 

Updates are immediately detected locally (for example, in my SourceTree environment). However, after forcibly pushing the modified repository on GitHub ...

 git push -f origin master 

... two separate elements stubbornly refuse to update the committer and the author: the Gemfile.lock file and the submission directory.

Also note that:

  • This is the second time I perform this kind of operation in this repository. I believe that for the first time I have not encountered such problems.

  • Searching for my old name in the repository ...

     $ find . "<oldname"> 

... gives a bunch of results, which means that the old name is still hidden in many files of the repository - including files that are updated both on GitHub and locally.

My question is: how can I change the committer / author of two stubborn files on GitHub?

+6
source share
2 answers

After using the git git filter branch, the repo history is still backed up in refs / original. This is so that if you ruin something using the filter branch, you can return if necessary. Once you are sure everything went smoothly, you can delete the backup with:

 git update-ref -d refs/original/refs/heads/master 

For some reason, github still needs extra commit to reflect the changes. I will add a space or something in the readme, commit and click ... after that, github reflects the correct authors on the project page.

+4
source

What exact view on GitHub do you use to identify the author of a line? It is probably either cached or you are looking at something specific for the old commit SHA1.

You can verify that this worked by making a new repo clone and checking git blame filename for these two files. If it shows the correct author, then it worked.

0
source

Source: https://habr.com/ru/post/917422/


All Articles