commit e0eb5b86e0661abdb88b5327caa479861a1d1714 (HEAD)
Author: Perry Yuan <perry_yuan@dell.com>
Date: Tue Jan 12 08:38:02 2021 -0500
add e.txt
add new to e
add new to c
commit 8030327c7250f75eef8037cfd93d61904bde4509
Author: Perry Yuan <perry_yuan@dell.com>
Date: Tue Jan 12 08:37:42 2021 -0500
add d.txt
commit 43b4d9399ef13eb8200575c2d24c249a1ac07070
Author: Perry Yuan <perry_yuan@dell.com>
Date: Sun Jan 10 09:50:37 2021 -0500
c.txt add more file to 3.txt
add my c.new file
commit 9e1c44ed2592ccc0a1d5d5efb0bcd80e36a738cd
Author: Perry Yuan <perry_yuan@dell.com>
Date: Sun Jan 10 09:50:11 2021 -0500
add a.txt file 1st
上面这是修改之前的 git log
我想修改 43b4d9399ef13eb8200575c2d24c249a1ac07070 这个commit 中的内容
#git rebase 9e1c44ed2592ccc0a1d5d5efb0bcd80e36a738cd --interactive
Stopped at 43b4d93... c.txt add more file to 3.txt add my c.new file
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
之后修改你要改的code
#git commit --amend
[detached HEAD aa5ad9c] c.txt add more file to 3.txt add my c.new file
Date: Sun Jan 10 09:50:37 2021 -0500
4 files changed, 7 insertions(+)
create mode 100644 add_new_file.txt
create mode 100644 b.txt
create mode 100644 c.new.txt
create mode 100644 c.txt
再rebase 到原来的分支.
#git rebase --continue
commit 4bd46b85049cf10cf6a3769c20b3074c2928a710 (HEAD)
Author: Perry Yuan <perry_yuan@dell.com>
Date: Tue Jan 12 08:38:02 2021 -0500
add e.txt
add new to e
add new to c
commit 3898c0a8f7fb68d1d62cd2eab95d508521f3b99f
Author: Perry Yuan <perry_yuan@dell.com>
Date: Tue Jan 12 08:37:42 2021 -0500
add d.txt
commit aa5ad9cff6735dda992c59eeb4faabd16c88377b
Author: Perry Yuan <perry_yuan@dell.com>
Date: Sun Jan 10 09:50:37 2021 -0500
c.txt add more file to 3.txt
add my c.new file
2. add new file ccc.new
commit 9e1c44ed2592ccc0a1d5d5efb0bcd80e36a738cd
Author: Perry Yuan <perry_yuan@dell.com>
Date: Sun Jan 10 09:50:11 2021 -0500
add a.txt file 1st
上面这是修改后的git log, 可以看到我已经修改了一部分内容到这个commit
commit aa5ad9cff6735dda992c59eeb4faabd16c88377b
Author: Perry Yuan <perry_yuan@dell.com>
Date: Sun Jan 10 09:50:37 2021 -0500
c.txt add more file to 3.txt
add my c.new file
2. add new file ccc.new