How to make changes to a previous git commit

I made 2 git commit

$ git log commit 9613e1e84b42aeef645977272d310250339cf0e0 commit 01f8699be310f9a56a40835b48a922a879bba24f 

Each of them concerns DIFFERENT FILES. And I did NOT push.

But I would like to fix the fix 01f8699be310f9a56a40835b48a922a879bba24f (not the top one). How can i do this?

I know that I can use 'git commit -amend' to make changes to the top commit. But not the second.

How can i fix this?

Thanks.

+6
source share
1 answer

Use interactive rebase. git rebase -i HEAD ~ 2 will redistribute the last two. You get the list in your editor and you can only edit one or more.

+8
source

Source: https://habr.com/ru/post/885460/


All Articles