My experience with git is limited. I am stuck with a problem where I made wrong changes to a couple of files (e.g foo.c and bar.c) and committed. After another commit I realized that my changes were bad. So, the wrong changes with these two files are in HEAD~1. The correct version of these files were checked in to HEAD~5 and HEAD~7 respectively.
What is the recommended way to remove the wrong edits? I tried this :
`git checkout SHA path_to_foo/foo.c`
But it does not actually modify foo.c so that I can create another commit with this.