In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to modify all the submitted usernames and mailboxes of git". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to modify all submitted usernames and mailboxes of git".
That is, modify the user name and email in all commit of git
Configuration method:
Git config-global user.email "youremail@google.com"
Git config-global user.name "your name"
But remedial measures will only work for future commit. If you want to modify previous author information, Github provides a reliable official guide: Changing author info. When I was going to do it, I found that the script I was going to copy and paste in the third step could not be found. Later I realized that Gist had been walled.
Hang up the SS and finally see the complete script. Post the complete steps of my translation below.
Change the author's information
To change the existing user name and / or email address of commit, you must rewrite the entire history of your Git repo.
Warning: this behavior can be destructive to your repo history. If your repo works with others, it's a bad habit to rewrite published history. Perform this operation only in an emergency.
Use scripts to change the Git history of your repo
We wrote a script that changed the old email address of the commit author to the correct user name and email address.
Note: executing this script will rewrite the history of all repo collaborators. After doing the following, anyone in fork or clone must get the rewritten history and put all local modifications rebase into the rewritten history.
The information you need to prepare before executing this script:
The old email address to be modified
Correct user name and email address
1. Open the terminal (Mac or Linux user) or the command line (Windows user).
two。 Create a new naked clone for your repo (replace repo.git with your project, same below)
Git clone-- bare https://github.com/user/repo.git
Cd repo.git
3. Copy and paste the script and modify the following variables according to your information:
OLD_EMAIL
CORRECT_NAME
CORRECT_EMAIL
Script:
#! / bin/shgit filter-branch-- env-filter 'OLD_EMAIL= "your-old-email@example.com" CORRECT_NAME= "Your Correct Name" CORRECT_EMAIL= "your-correct-email@example.com" if ["$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL"] then export GIT_COMMITTER_NAME= "$CORRECT_NAME" export GIT_COMMITTER_EMAIL= "$CORRECT_EMAIL" fiif ["$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
4. Press Enter to execute the script.
5. Check the new Git history for errors.
6. Push the correct history to Github: (when push has difficulty, remember to modify DNS or build × ×)
Git push-force-tags origin 'refs/heads/*'
7. Clear temporary clone.
Cd..
Rm-rf repo.git
All done! Now all the lost contribution is back ~ remember to sign in on Github in the new year ~
Thank you for your reading, the above is the content of "how to modify all submitted user names and mailboxes of git". After the study of this article, I believe you have a deeper understanding of how to modify all submitted user names and mailboxes of git. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.