How to amend an older commit

Sometimes we need to update an older commit, this is solution to do it:

1. Do you changes and commit them.

2. Rebase your repository to commit you want to change:

git rebase -i {your commit id}~

3. Move your new commit directly after commit you want to update

4. Replace pick with fixup of your commit.

5. Save your changes

6. If there will be conflicts solve them and then use command:

git rebase --continue