修改git commit 除了 git commit --amend 还有 git commmit rebase, reset, .
来源:互联网 发布:淘宝钻石展位要求 编辑:程序博客网 时间:2024/06/04 18:57
当你不小心,写错了提交的注视/信息,该如何处理呢。理论上,SCM是不应该修改历史的信息的,提交的注释也是。
不过在git中,其commit提供了一个--amend参数,可以修改最后一次提交的信息.但是如果你已经push过了,那么其历史最后一次,永远也不能修改了。
我使用git commit --amend已经push过的,截图如下,我那个"fixes #3"永远的在版本历史中了。
git commit --amend
的用法,,,
# git commit --amend
然后在出来的编辑界面,直接编辑 注释的信息。。
===========================================================================================================
===========================================================================================================
git修改历史提交
git使用amend选项提供了最后一次commit的反悔。但是对于历史提交呢,就必须使用rebase了。
git rebase -i HEAD~3
表示要修改当前版本的倒数第三次状态。
这个命令出来之后,会出来三行东东:
pick:*******
pick:*******
pick:*******
如果你要修改哪个,就把那行的pick改成edit,然后退出。
这时通过git log你可以发现,git的最后一次提交已经变成你选的那个了,这时再使用:
git commit --amend
来对commit进行修改。
修改完了之后,要回来对不对?
使用git rebase --continue
OK,一切都搞定了。
==============================================================
Git修改前一次提交的方法(特别注意保持Change-Id不变)
git rebase -i master~1 //最后一次
git rebase -i master~5 //最后五次
2. // 显示结果如下,修改 pick 为 edit ,并 :wq 保存退出
pick 92b495b 2009-08-08: ×××××××
# Rebase 9ef2b1f..92b495b onto 9ef2b1f
#
# Commands:
# pick = use commit
# edit = use commit, but stop for amending //改上面的 pick 为 edit
# 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.
#
3. 命令行显示:
Rebasing (1/1)
You can amend the commit now, with
git commit --amend
4. 使用 git commit --amend 进行修改,完成后 :wq 退出
5. 使用 git rebase --continue 完成操作
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset,
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset, .
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset,
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset,
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset
- git commit/git commit --amend/git commmit rebase, reset
- rewinding-git-commit-amend
- git commit --amend
- git commit --amend用法
- git commit --amend
- git commit --amend打补丁
- git 撤销操作--git checkout、git reset、git revert、git commit -- amend
- git commit --amend 改写提交
- 单步commit悔棋 ----- git commit --amend
- 【git】git commit –amend命令修改comment
- git (5) -- git commit --amend问题
- 不借助git commit --amend 修改提交说明
- Linux C语言编程 之 线程同步机制
- PHP中include与require的用法区别
- 使用CSS和jQuery 模拟select
- Google中国2014校园招聘笔试Round B China New Grad Test Problem E. Ignore all my comments
- EasyUi_学习之路_04
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset, .
- 0.ring3-hook-GetThreadContext注意点(获取threadcontext错误点)
- linux下读取cpu核温度。
- 让IE6支持max/min-height/width样式属性方法
- 获取二叉树第n层的节点个数
- 如何预测用户query意图
- 怎樣下載JAVA JDK的API幫助文檔壓縮包
- Dolphin Player编译
- C++ 虚函数表解析