DEV Community

fireWinters
fireWinters

Posted on

how to change the author's name in committed git records.

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
Enter fullscreen mode Exit fullscreen mode

it works.We should force push our local branch to github.

git push --force origin branch-name

Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

I still have a lot to learn

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️