github:已经提交并push后再次追加提交

GitRebase修正提交示例
本文介绍如何使用Git的Rebase命令修改最近一次提交的内容,包括修改提交信息及文件,最后强制推送更新到远程仓库。

快速链接:
.
👉👉👉 个人博客笔记导读目录(全部) 👈👈👈

(1)修改倒数第1次的commit

指令:$ git rebase -i HEAD~1

(2)修改pick为edit

// 这里修改代码、以及git add

(3)$ git commit --amend

按i进入编辑模式,修改内容,退出编辑模式,输入:wq保存并退出

(4)$ git rebase --continue

(5)强制push
$ git push --force github

例如:

test@test-21:~/workspace/optee/my_opteeos/optee_os$ git rebase -i HEAD~1
Stopped at 615c14d4...  scripts : check the input already signed before signing a TA
You can amend the commit now, with

  git commit --amend 

Once you are satisfied with your changes, run

  git rebase --continue


test@test-21:~/workspace/optee/my_opteeos/optee_os$ git add scripts/sign_encrypt.py
test@test-21:~/workspace/optee/my_opteeos/optee_os$ git commit --amend
[detached HEAD cd49d655] scripts : Check the input already signed before signing a TA
 Date: Mon Jan 25 23:06:04 2021 +0800
 1 file changed, 11 insertions(+)


test@test-21:~/workspace/optee/my_opteeos/optee_os$ git push --force https://github.com/baronZhou/optee_os.git
Username for 'https://github.com': baronZhou
Password for 'https://baronZhou@github.com': 
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 897 bytes | 149.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/baronZhou/optee_os.git
 + 615c14d4...cd49d655 master -> master (forced update)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Arm精选

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值