How to revert changes to 1 file in previous commit
Using SourceTree preferably or a simple git command, how would I undo the changes to 1 file in previous commit. Saying it another way, how to reverse a commit, but only for 1 of many files that were committed?
Looking to avoid having to reverse the whole commit and then recommit all but the 1 file's changes.
I ended up just manually "reverting" the 1 file by editing it. But got 2 good looking answers though, I'll pick the one that appears to work in more cases.
git revert <commit> --no-commit #reverts the whole commit, putting changes in index and working dir
git reset HEAD . #clears index of changes
git add <fileyouwanttorevert> #adds changes to that one file to index
git commit -m "Reverting the file" #commits that one file's changes
git checkout . #gets rid of all the changes in working directory