Say I commit 5 files with changes. Then I realize that I want to revert so that I can get rid of the changes in 2 of them, but I want to keep the changes in the other 3. Is there a reasonable way to do this? Does that change if I've pushed?
Thanks.
Say I commit 5 files with changes. Then I realize that I want to revert so that I can get rid of the changes in 2 of them, but I want to keep the changes in the other 3. Is there a reasonable way to do this? Does that change if I've pushed?
Thanks.
You can use git checkout
to check out a previous version of the file using a "good" commit ID:
git checkout good-commit-sha -- path/to/file1
git checkout good-commit-sha -- path/to/file2
git commit