git 撤销commit mesage

已经本地提交了,但是还未push到远程仓库。这时如果想对提交记录做修改。可以用git reset 命令:

git log


commit ce30b18acf73b005219f951dbebf4bdfea8f663e
Author: songchong <songchong@artekmicro.com>
Date:   Mon Aug 27 17:23:08 2018 +0800

    6ss

commit 230e2a9b76941155e11b67b640401cd9154ae97e
Author: songchong <songchong@artekmicro.com>
Date:   Thu Aug 23 16:51:05 2018 +0800

    add 5s

commit a6ce37fc80559685a5aa68634411242e6e3fe081
Author: songchong <songchong@artekmicro.com>
Date:   Thu Aug 23 10:59:24 2018 +0800

    add 3s

commit 9ed7ef2909d1840be64a7719c0d068456def60c2
Author: songchong <songchong@artekmicro.com>
Date:   Thu Aug 23 10:58:48 2018 +0800

    add usb

commit b1ebd90e1174ee954e241f11d24e937e2e3421b1
Author: songchong <songchong@artekmicro.com>
Date:   Thu Aug 23 10:58:13 2018 +0800

    add test.c

想撤销最后三个commit message 的提交,(只是撤销提交记录,提交内容不改变)

git reset --soft commitID

git reset --soft 9ed7ef2909d1840be64a7719c0d068456def60c2

这样就记录回退了

songchong@srv-artek-pad:~/mytest/gittest$ git log
commit 9ed7ef2909d1840be64a7719c0d068456def60c2
Author: songchong <songchong@artekmicro.com>
Date:   Thu Aug 23 10:58:48 2018 +0800

    add usb

commit b1ebd90e1174ee954e241f11d24e937e2e3421b1
Author: songchong <songchong@artekmicro.com>
Date:   Thu Aug 23 10:58:13 2018 +0800

    add test.c

然后可以重新编辑commit message重新提交。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值