I'm trying to edit a specific old commit, basically un-commit some changes that were made to a few files in that commit. I'm using:
git rebase --interactice 'fghj554^'
And then selects 'edit'
for that commit. However I'm being taken to the stage where those changes are already present in the files, and typing "git status" will show there's nothing to commit.
Is there a way to unstage the comitted files, so that I can use git restore
for example, and not commit some changes to some files?
CodePudding user response:
That's how it's supposed to work.... so now, if you want to revert some changes, just run git checkout HEAD~ -- file1 file2
(notice the pig tail) so that you can get those files to the way they ware before... or use your IDE to compare with the previous commit (though it could be other commits)... and then get the files the way you want. When you are done:
git add file1 file2 blahblah
git commit --amend
git rebase --continue