git 重写历史
- 重写最后一次提交的commit
git commit --amend
 - 修改多个历史
git rebase -i HEAD~3
命令执行后结果如下:

pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file # Rebase 710f0f8..a5f4a0d onto 710f0f8
#
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
将你想修改的每一次提交前面的pick改为edit
edit f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file当你保存并退出编辑器,Git会倒回至列表中的最后一次提交,然后把你送到命令行中,同时显示以下信息:

$ git rebase -i HEAD~3
Stopped at 7482e0d... updated the gemspec to hopefully work better
You can amend the commit now, with git commit --amend Once you’re satisfied with your changes, run git rebase --continue
然后
$ git commit --amend $ git rebase --continue
ok一切搞定。
 
参照资料地址:http://git-scm.com/book/zh/ch6-4.html
git 重写历史的更多相关文章
- [转]Git - 重写历史
		
转自http://git-scm.com/book/zh/Git-%E5%B7%A5%E5%85%B7-%E9%87%8D%E5%86%99%E5%8E%86%E5%8F%B2 重写历史 很多时 ...
 - Git 重写历史 filter-branch
		
source:https://git-scm.com/book/zh/v1/Git-%E5%B7%A5%E5%85%B7-%E9%87%8D%E5%86%99%E5%8E%86%E5%8F%B2 重写 ...
 - git合并历史提交
		
背景 以前一直觉得只要pull和push就够了,但合作中总会遇到各种非理想的情况.这时候才发现git其他命令的作用. 现在的情况是,repo是一个远程team维护的,我们需要增加新feature,那么 ...
 - git 修改历史提交信息
		
当你不小心,写错了提交的注视/信息,该如何处理呢.理论上,SCM是不应该修改历史的信息的,提交的注释也是. 不过在git中,其commit提供了一个--amend参数,可以修改最后一次提交的信息. ...
 - Git提交代码规范  而且规范的Git提交历史,还可以直接生成项目发版的CHANGELOG(semantic-release)
		
Git提交代码规范 - 木之子梦之蝶 - 博客园 https://www.cnblogs.com/liumengdie/p/7885210.html Commit message 的格式 Git 每次 ...
 - 三分钟教你学Git(十八) - 重写历史
		
git filter-branch 同意你使用一个单一命令来大范围地更改历史.所以这个命令要慎用. 1假如你想对全部的commits删除一个文件. git filter-branch --tree-f ...
 - git重写历史记录
		
1 修改上一次历史提交,替换掉上次的提交git commit --amend 2 git rebase 将不同分支路径合并到同一分支路径上eg:将master分支上的 conflic rebase合并 ...
 - git 版本历史
		
版本:git rev-parse --git-dir显示Git版本库的位置 --show-cdup显示当前工作区目录的深度 --parseopt解析命令行参数 $ git rev-parse - ...
 - Git基本命令 -- 历史
		
历史. 收先需要了解一下git log命令, 使用git的帮助看看: git help log: 执行该命令后, 我的win10弹出来一个html页面, 里面是git log命令的帮助: 首先看看gi ...
 
随机推荐
- java面向对象(上)
			
一.一些重要的概念理解 Java是面向对象的程序设计语言,提供了类,成员变量,方法等的基本功能.类可被认为是一种自定义的数据类型,可以使用类来定义变量,所有使用类定义的变量都是引用变量.它会引用到类的 ...
 - Yii2如何批量添加数据
			
批量添加这个操作,在实际开发中经常用得到,今天小编抽空给大家整理些有关yii2批量添加的问题,感兴趣的朋友一起看看吧. 在上篇文章给大家介绍了关于浅析Yii2 gridview实现批量删除教程,当然, ...
 - 沈阳网络赛G-Spare Tire【容斥】
			
17.64% 1000ms 131072K A sequence of integer \lbrace a_n \rbrace{an} can be expressed as: \display ...
 - angular-translate国际化
			
1.<h1>{{"hello" | translate}}</h1>2.<h1 ng-bind-html="'hello' | transl ...
 - C#学习笔记之(Hellow,WORLD;常量和变量;键盘输入和输出;数据类型转换;计算器)
			
HELLO,WORLD Console.Write 表示向控制台直接写入字符串,不进行换行,可继续接着前面的字符写入. Console.WriteLine 表示向控制台写入字符串后换行. Consol ...
 - HDU_3486_Interviewe
			
Interviewe Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
 - Maven的pom文件配置
			
pom.xml文件如下: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http:// ...
 - T-SQL练习题
			
转自:http://www.cnblogs.com/jenrrychen/p/5348546.html 1 - 3 题: 数据表结构: OrderID ProductID OrderDate Sal ...
 - try...cath...finally中的return什么时候执行
			
一finally可以没有,也可以只有一个.无论有没有发生异常,它总会在这个异常处理结构的最后运行.即使你在try块内用return返回了,在返回前,finally总是要执行,这以便让你有机会能够在异常 ...
 - 1.2 Getting Started--Naming Conventions(命名约定)
			
Ember.js使用一个运行时解析器去连接你的对象而没有很多样板文件.作为一个开发者,如果你把code放到约定好的位置这个解析器会自动工作. 一.The Application 1. 当你 ...