git revert one commit
git reset --soft HEAD~1
git revert only part of commit
Use the --no-commit (-n) option to git revert, then unstage the changes, then use git add --patch:
$ git revert -n $bad_commit # Revert the commit, but don't commit the changes
$ git reset HEAD . # Unstage the changes
$ git add --patch . # Add whatever changes you want
$ git commit # Commit those changes
Note: The files you add using git add --patch are the files you want to revert, not the files you want to keep.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us