git commit --amend

修改刚才提交的commit信息

撤销 git commit --amend

思路是使用 git reflog 查看在哪里ammend的.找到HEAD{N},

N是ammend之前的那个数.

然后使用git reset --soft HEAD@{N}

see at http://stackoverflow.com/questions/1459150/how-to-undo-git-commit-amend-done-instead-of-git-commit

# Move the current head so that it's pointing at the old commit
# Leave the index intact for redoing the commit
git reset --soft HEAD@{1} # commit the current tree using the commit details of the previous
# HEAD commit. (Note that HEAD@{1} is pointing somewhere different from the
# previous command. It's now pointing at the erroneously amended commit.)
git commit -C HEAD@{1}

git 修改上次提交信息 与 撤销此操作.的更多相关文章

  1. git 修改历史提交信息

    当你不小心,写错了提交的注视/信息,该如何处理呢.理论上,SCM是不应该修改历史的信息的,提交的注释也是.   不过在git中,其commit提供了一个--amend参数,可以修改最后一次提交的信息. ...

  2. Git 修改历史提交信息 commit message

    修改最近一条提交的消息 git commit --amend 进入vim模式 按字母 o 或者 insert键 开始修改内容 按 esc 推出编辑,最常用的是输入":q"直接退出, ...

  3. git 修改已提交了的备注信息的方法

    git 修改已提交了的备注信息的方法: 1.当我们已通过 git commit -m '已提交的最新的备注' 命令将代码提交到了缓存区,或者进一步执行了 git push origin master ...

  4. 使用git命令修改commit提交信息

    很多时候我们在提交代码时可能会把commit提交信息写错了,这个时候我们就可以用到下面的git命令来修改commit提交信息 git commit --amend 输入"i"之后进 ...

  5. git 修改已提交的注释

    在git中,其commit提供了一个--amend参数,可以修改最后一次提交的信息 修改最后一次提交注释 git commit --amend 然后在出来的编辑界面,直接编辑注释的信息,保存退出 gi ...

  6. Git修改已经提交的用户名信息

    由于工作或者其他原因,有时候我们会修改git的用户名和邮箱账号,没有改过来就提交,就会导致提交人信息不一致的问题.现在记录修正回来的方法 # 第一步,(n)代表提交次数 git rebase -i H ...

  7. Git show-branch显示提交信息

    git中查看日志,我们用的比较多的就是 git log 以及带一些参数,如: 以一行显示提交日志: $ git log --pretty=oneline 显示最后的几次提交日志: $ git log ...

  8. Git修改已经提交的注释或日志

    对于已经修改提交过的注释,如果需要修改,可以借助 git commit --amend 来进行.(注意:修改日志的功能在svn中需要server支持,在git中可以独立修改) 注意:必须是最近提交,还 ...

  9. 【转】Git 修改已提交的commit注释

    https://www.jianshu.com/p/098d85a58bf1 [重点] 通过git rebase -i HEAD~2 你想修改哪条注释 就把哪条注释前面的pick换成edit git ...

随机推荐

  1. OpenCV 学习笔记03 findContours函数

    opencv-python   4.0.1 1 函数释义 词义:发现轮廓! 从二进制图像中查找轮廓(Finds contours in a binary image):轮廓是形状分析和物体检测和识别的 ...

  2. easyUI设置textbox的值

    我们知道<input type="text" class="easyui-validatebox" id="txtrName" nam ...

  3. Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371)

    Purpose This article provides steps for extending the root partition residing in a logical volume cr ...

  4. win10 标注工具LabelImg 安装使用

    安装步骤(默认已经安装了Python3.X ): pip 安装PyQt5 进入cmd(Win键 + R键,输入cmd,enter键入),输入: >>pip install PyQt5 如果 ...

  5. ARM:移动GPU往PC GPU效能迈进

    行动装置的热潮持续不退,各大手机制造商除了想尽办法推出外型酷炫的行动装置设备来吸引消费者的目光之外,更在行动应用处理器玩起多核心的「核」战争,无非是希望能够带给消费者更优异的效能新体验.然而,随着消费 ...

  6. iphone5 jail break

    dfu恢复恢复备份越狱afc2add删除2个文件,如果只有1个也没问题/var/mobile/Library/Caches/com.apple.mobile.installation.plist/va ...

  7. 已安装 SQL Server 2005,安装 SQL Server 2008 时提示需要删除 SQL Server 2005 Express 工具

    错误提示:已安装  SQL Server 2005 Express 工具.若要继续,请删除 SQL Server 2005 Express 工具.  解决方案: 修改注册表:HKLM\Software ...

  8. Java Web(十一) 分页功能的实现

    虽然现在有很多好用的框架,对分页进行支持,很简单的就把分页的效果做出来,但是如果自己手写是一个怎样的流程的?今天就来说说它,手动实现分页效果. --WH 一.分页的思路 首先我们得知道写分页代码时的思 ...

  9. rdesktop 源码安装

    # ./configure --prefix=/data/apps/rdesktop-1.6.0 #make && make install

  10. TCPConnectionTermination

    http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for- ...