A few weeks ago (i.e. many commits ago), I made a git commit that touched many files. Most of the commit was great.
However, I'd now like to undo the changes that I'd made to just one of those files, but I don't want to override any changes that had been made to that file after that commit.
Is there a way for me to revert a specific commit but only on one of the files in that commit?
Get a patch-ready diff for that file in that commit, and then reverse-apply the patch:
git show <commit-id> -- <path> | git apply -R -
Make sure you like the result, and if so, add and commit with appropriate message.
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