Git 提交更改

Jerry 已经提交的更改,他想纠正他的最后一次提交,在这种情况下,git 的修改将帮助操作。最后提交修改操作的变化,包括提交信息,它创建新的提交ID。

修改操作之前,他会检查提交日志。

[jerry@CentOS project]$ git log

上面的命令会产生以下结果。

commit cbe1249b140dad24b2c35b15cc7e26a6f02d2277 Author: Jerry Mouse <jerry@yiibai.com> Date: Wed Sep 11 08:05:26 2013 +0530 Implemented my_strlen function commit 19ae20683fc460db7d127cf201a1429523b0e319 Author: Tom Cat <tom@yiibai.com> Date: Wed Sep 11 07:32:56 2013 +0530 Initial commit

Jerry 提交了新的变化 – 修改操作,并查看提交日志。

[jerry@CentOS project]$ git status -s M string.c ?? string [jerry@CentOS project]$ git add string.c [jerry@CentOS project]$ git status -s M string.c ?? string [jerry@CentOS project]$ git commit –amend -m ‘Changed return type of my_strlen to size_t’ [master d1e19d3] Changed return type of my_strlen to size_t 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 string.c

现在 git 的日志,将显示新的提交信息与新的提交ID

[jerry@CentOS project]$ git log

上面的命令会产生以下结果。

commit d1e19d316224cddc437e3ed34ec3c931ad803958 Author: Jerry Mouse <jerry@yiibai.com> Date: Wed Sep 11 08:05:26 2013 +0530 Changed return type of my_strlen to size_t commit 19ae20683fc460db7d127cf201a1429523b0e319 Author: Tom Cat <tom@yiibai.com> Date: Wed Sep 11 07:32:56 2013 +0530 Initial commit

 

PS:如果您想和业内技术大牛交流的话,请加qq群(521249302)或者关注微信公众 号(AskHarries),谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值