How can I change the commit email for every commit I ever made? #170960
Replies: 4 comments
-
|
Once commits are pushed, their author email is permanently tied to the commit history. GitHub shows them on your profile only if the email is linked to your account. To keep contributions visible, you should leave the old email connected to your GitHub (it doesn’t need to be your primary email). Rewriting all past commits with a new email is technically possible using |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
Hi @shriyanyamali, Yes, you can rewrite your entire commit history by amending your email address. Once you've added your new email address to GitHub, I also recommend setting it to private using GitHub's noreply email. Go to your email settings, and check the option " Next, run the following script in your local repo, replace " #!/bin/sh
OLD_EMAIL="old_email"
NEW_EMAIL="new_email"
git filter-branch --env-filter '
OLD_EMAIL="'"$OLD_EMAIL"'"
CORRECT_EMAIL="'"$NEW_EMAIL"'"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tagsThen run Finally, force push the changes to your remote repo: git push --force --allNote that you should perform this step for each repository you own. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I used to use an email, but I no longer use it and want to remove it from my GitHub account. My issue is that if I remove it, the thousand commits I made with that email no longer show up on my profile. I don't want to keep it on my account, so is it possible for me to change every single commit I made using that account to the new email which I added to my GitHub account? I used Git and made most of my commit remotely.
Beta Was this translation helpful? Give feedback.
All reactions