Sometimes when I have done some changes (git diff) I want part of them (only particular files) add to older commit.
What is the easiest way to do it?
You could add the changes you would like to merge in an older commit like this
git add [path] or git add -p
then create a fixup commit with the hash of the commit you would like to move those changes
an example:
git commit --fixup [commit hash]
To merge these 2 commits into 1 you will finally need to do interactive rebase
git rebase -i origin/[branch name] --autosquash
Be ware that you have to force push (with caution) after an interactive rebase
git push -f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With