Can I do a partial revert in GIT

You can revert the commit without creating a new one by adding the --no-commit option. This leaves all the reverted files in the staging area.

From there, I’d perform a mixed reset (the default for reset) to un-stage the files, and add in the changes I really wanted. Then, commit, (you can add and commit more files if you want multiple commits), and finally, checkout the current directory to wipe out any uncommitted and un-staged modifications resulting from the revert. For an example workflow:

git revert <sha-of-bad-commit> --no-commit
git reset   # This gets them out of the staging area

# ...edit bad file to look like it should, if necessary

git add <bad-file>
git commit
git checkout . # This wipes all the undesired reverts still hanging around in the working copy

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)