修改git commit 除了 git commit --amend 还有 git commmit rebase, reset
来源:互联网 发布:零售软件解决方案 编辑:程序博客网 时间:2024/06/05 03:46
不过在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 修改提交说明
- RabbitMQ中 exchange、route、queue的关系
- ps命令 du命令 lsof
- 深入分析Android开机找网延迟
- 计算1-1/2+1/3-1/4...+1/99-1/100的值
- struts2中接收请求参数(尤其是复合类型)
- 修改git commit 除了 git commit --amend 还有 git commmit rebase, reset
- A Comparison between Focus-Group and In-Depth Interview
- HTTPCLIENT POST JSON
- mongo的安装和部署
- mj使用
- CentOS 6.3 - 安装 Nginx 1.2.7(yum源)
- 调用notifyDataSetChanged方法失败的常见原因
- MFC SendMessage与PostMessage
- 判断1000-2000年的闰年