[转] 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.gitCopy 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
[转] 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 ...
随机推荐
- Android Learning:多线程与异步消息处理机制
在最近学习Android项目源码的过程中,遇到了很多多线程以及异步消息处理的机制.由于之前对这块的知识只是浅尝辄止,并没有系统的理解.但是工程中反复出现让我意识到这个知识的重要性.所以我整理出这篇博客 ...
- 【Java】整理关于java的String类,equals函数和比较操作符的区别
初学 Java 有段时间了,感觉似乎开始入了门,有了点儿感觉但是发现很多困惑和疑问而且均来自于最基础的知识折腾了一阵子又查了查书,终于对 String 这个特殊的对象有了点感悟大家先来看看一段奇怪的程 ...
- 安卓天天练练(十)ListView
ListView不能和ScrollView同时使用,因为它已经包含了滚动支持. 还有个Gallery http://blog.csdn.net/dazlly/article/details/78639 ...
- Java Servlet的request使用的编码引发的思考 以及解决方法
如果我们用浏览器填写了中文,而在服务器Servlet上没有进行编码设置,那么将会出现乱码. 出现乱码的原因是:浏览器发送的文字是以UTF-8编码发送的,然后调用request.getParameter ...
- 如何修改Ubuntu双系统的默认开机启动项
转自:http://jingyan.baidu.com/article/ed15cb1b05d0311be369818a.html 对 于安装Ubuntu系统和windows系统(windows xp ...
- gridview数据导出到word和excel以及excel的导入
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI ...
- Delphi直接让QT进入指定房间
WinExec('./QT/QT.exe qt://join/?roomid=3955&subroomid=287307288&ext=gid:536023504;et:1001', ...
- BZOJ2083: [Poi2010]Intelligence test
2083: [Poi2010]Intelligence test Time Limit: 10 Sec Memory Limit: 259 MBSubmit: 241 Solved: 96[Sub ...
- js键盘控制DIV移动
<style type="text/css"> html,body{overflow:hidden;}body{margin:0;padding:0;}pre{colo ...
- HDU 5933 ArcSoft's Office Rearrangement 【模拟】(2016年中国大学生程序设计竞赛(杭州))
ArcSoft's Office Rearrangement Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...