Reputation: 63
What are best practices to accomplish this task:
I have commits:
A -- B -- C
Commit B consist of:
file1.java
file2.java
icon.png
I would like to undo changes to file1
and file2
but not to icon.png
.
Upvotes: 4
Views: 124
Reputation: 793027
You can stage a revert of commit B and then reset the image file before committing.
# Prepare a revert of B
git revert -n B
# Recover the current version of the image
git checkout HEAD -- icon.png
# Commit the "almost" reversion of B
git commit
Upvotes: 3