惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
The Last Watchdog
The Last Watchdog
小众软件
小众软件
S
Security @ Cisco Blogs
S
Schneier on Security
Forbes - Security
Forbes - Security
S
Secure Thoughts
W
WeLiveSecurity
Latest news
Latest news
博客园 - Franky
Last Week in AI
Last Week in AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
美团技术团队
Schneier on Security
Schneier on Security
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
B
Blog
GbyAI
GbyAI
A
About on SuperTechFans
爱范儿
爱范儿
博客园 - 叶小钗
T
Tor Project blog
SecWiki News
SecWiki News
Blog — PlanetScale
Blog — PlanetScale
A
Arctic Wolf
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
GRAHAM CLULEY
Webroot Blog
Webroot Blog
Google Online Security Blog
Google Online Security Blog
博客园 - 三生石上(FineUI控件)
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
The Register - Security
The Register - Security
C
CERT Recently Published Vulnerability Notes
K
Kaspersky official blog
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
V2EX - 技术
V2EX - 技术
Help Net Security
Help Net Security
阮一峰的网络日志
阮一峰的网络日志
Recent Announcements
Recent Announcements
J
Java Code Geeks

胡方运的博客

macOS App 开发 iCloud 不同步问题解决 机票还能这么买!随心飞低价旅行攻略 提前避坑:父母患病和医保问题 我和 Apple 开发的缘分 我的手机流量和宽带套餐性价比方案 iMessage 在国内好用吗? 为什么要写博客 macOS 升级 beta 系统后,如何打开原来版本的 XCode Xcode 安装依赖超时问题解决办法 短信转发-多设备多平台 Follow RSS 阅读 App 记录一次服务器重启应用恢复过程 macOS 重装踩坑记 我的 2021 我的 2020 年终总结 如何给网站添加免费的 https 证书 如何管理多个 git 账号 写给自己的JavaScript系列之一步步写个 JavaScript 解释器 JavaScript 文件的异步加载 async 和 defer
如何修改 git 已提交的用户名和邮箱
感谢您的阅读。 🙏 关于转载请看这里 · 2018-09-19 · via 胡方运的博客

1、修改上一次提交的邮箱和用户名

git commit --amend --reset-author

2、批量修改多次提交的邮箱和用户名

新建一个 shell 脚本 changeGitInfo.sh

#!/bin/sh

git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "这里写你原来的邮箱" ]
then
cn="你想替换成的用户名"
cm="你想替换成的邮箱"
fi
if [ "$GIT_AUTHOR_EMAIL" = "这里写你原来的邮箱" ]
then
an="你想替换成的用户名"
am="你想替换成的邮箱"
fi
export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
'

git 仓库(项目)下运行一下,该脚本即可。

如果避免上面的问题?

可以看我的这篇博文 如何管理多个 git 账号