[转] git修改author
Changing author info
To change the name and/or email address recorded in existing commits, you must rewrite the entire history of your Git repository.
Warning: This action is destructive to your repository's history. If you're collaborating on a repository with others, it's considered bad practice to rewrite published history. You should only do this in an emergency.
Changing the Git history of your repository using a script
We've created a script that will change any commits that previously had the old email address in its author or committer fields to use the correct name and email address.
Note: Running this script rewrites history for all repository collaborators. After completing these steps, any person with forks or clones must fetch the rewritten history and rebase any local changes into the rewritten history.
Before running this script, you'll need:
- The old email address that appears in the author/committer fields that you want to change
The correct name and email address that you would like such commits to be attributed to
Open Git Bash.
Create a fresh, bare clone of your repository:
- git clone --bare https://github.com/user/repo.git
- cd repo.git
- git clone --bare https://github.com/user/repo.git
Copy and paste the script, replacing the following variables based on the information you gathered:
OLD_EMAIL
CORRECT_NAME
CORRECT_EMAIL
git 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"
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
- Press Enter to run the script.
- Review the new Git history for errors.
Push the corrected history to GitHub:
- git push --force --tags origin 'refs/heads/*'
Clean up the temporary clone:
- cd ..
- rm -rf repo.git
- cd ..
[转] git修改author的更多相关文章
- git修改文件名大小写的方法。
首先,在git命令行里面运行: git config core.ignorecase false 此命令是全局设置,以后在此机子上clone出来的git仓库工程都沿用此设置.当然,以前就已经clone ...
- git 修改历史提交信息
当你不小心,写错了提交的注视/信息,该如何处理呢.理论上,SCM是不应该修改历史的信息的,提交的注释也是. 不过在git中,其commit提供了一个--amend参数,可以修改最后一次提交的信息. ...
- git log --author详解,这个是个模糊匹配
git log --author=authorname --author=<pattern>, commits whose author matches any of the given ...
- Git 修改用户名以及提交邮箱
问题背景: 在已毕业师兄的电脑上提交自己的 Github 代码,(尽管有重新设置了 自己的SSH),但是 Github网站提交结果却显示师兄提交的: 验证当前本地属性: 怎么知道本地有设置?git c ...
- git修改用户名以及邮箱
git 修改当前的project的用户名的命令为:git config user.name 你的目标用户名; git 修改当前的project提交邮箱的命令为:git config user.emai ...
- [转]git修改远程仓库地址
原文链接:http://www.cnblogs.com/lazb/articles/5597878.html 问:Coding远程仓库地址变了,本地git仓库地址如何更新为最新地址 git修改远程仓库 ...
- git 修改commit 的注释
git 修改commit 的注释 一:最新的一次提交 当你不小心,写错了提交的注视/信息,该如何处理呢.理论上,SCM是不应该修改历史的信息的,提交的注释也是. 不过在git中,其commit提 ...
- git 修改已提交了的备注信息的方法
git 修改已提交了的备注信息的方法: 1.当我们已通过 git commit -m '已提交的最新的备注' 命令将代码提交到了缓存区,或者进一步执行了 git push origin master ...
- git 修改最后一次提交
git 修改最后一次提交 有时候我们提交完了才发现漏掉了几个文件没有添加,或者提交信息写错了. 此时,可以运行带有 --amend 选项的提交命令来重新提交:git commit --amend -m ...
随机推荐
- 编程思想—面向切面编程(AOP)
谈到面向切面的编程,我们很容易关联到面向对象编程(OOP).个人对这两种编程方式的解释为:两种编程思想只是站在编程的角度问题. OOP注重的是对象,怎么对对象行为和方法的抽象.如何封装一个具有完整属性 ...
- 日期相关---SimpleDateFormat的setLenient(true/false)-----自动计算日期
有时候我们需要判断用户的日期格式是否正确, 虽然绝大多数会在前台处理,但是也有需要从文件流读入的情况,如果日期不合格就需要抛异常,这时候就需要禁止SimpleDateFormat的自动计算功能. 这时 ...
- [HDOJ 5183] Negative and Positive (NP) 【Hash】
题目链接:HDOJ - 5183 题目分析 分两种情况,奇数位正偶数位负或者相反. 从1到n枚举,在Hash表中查询 Sum[i] - k ,然后将 Sum[i] 加入 Hash 表中. BestCo ...
- JdbcTemplate 操作Oracle Blob
1:增加操作 public int addTest(TestVo tv) { byte bz[] = tv.getBz().getBytes(); LobHandler lobHandler = ne ...
- MIST
获取当前状态机 modelObj.states[modelObj.curStatus.stateId] "FH_Search" modelObj.states[modelObj.p ...
- QiQi and Symmerty
http://sdu.acmclub.com/index.php?app=problem_title&id=961&problem_id=23772 题意:给出一个01串,问有多少个子 ...
- WordPress特制字符串URL重定向限制绕过漏洞
漏洞版本: WordPress 3.6 漏洞描述: Bugtraq ID:62344 CVE ID:CVE-2013-4339 WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PH ...
- Linux Kernel 多个本地拒绝服务漏洞
漏洞名称: Linux Kernel 多个本地拒绝服务漏洞 CNNVD编号: CNNVD-201308-154 发布时间: 2013-08-12 更新时间: 2013-08-12 危害等级: 漏 ...
- 支付宝APP支付(Java后台生成签名具体步骤)
/** *支付宝支付 * @param orderId 订单编号 * @param actualPay 实际支付金额 * @return */ private String getOrderInfoB ...
- Linux Shell编程(24)——命令替换
命令替换 将会重新分配一个命令[1]甚至是多个命令的输出; 它会将命令的输出如实地添加到另一个上下文中. [2]使用命令替换的典型形式是使用后置引用(`...`). 后置引用形式的命令(就是被反引号括 ...