Today I reviewed how to change the author's name in a committed git record.how to fix I've deleted the specific branch on GitHub, but I still see it in my Git records locally.
1.Change the author's name.
git filter-branch is used as an example:
git filter-branch --env-filter '
OLD_EMAIL="old.email@example.com"
CORRECT_NAME="New Name"
CORRECT_EMAIL="new.email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
it works.We should force push our local branch to github.
git push --force origin branch-name
2.Synchronize local and remote git branch records
I've deleted the branch-name branch on GitHub, I still see it in my Git records locally. This can happen because my local repository retains references to the deleted branch.
Here is a solution:
git fetch --prune
I still have a lot to learn
Top comments (0)