git undo the last commit

1. Local commit, not pushed to remote warehouse

You can git reset --soft <commit_id>, commit_id is a version to be rolled back to

Then make changes, and then commit,

If you need to completely discard the file changes and go back to a certain version, just git reset --hard

 

2. Undo the commit submitted to the remote

git revert <commit_id> 

git push --force (specify branch depending on the situation)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325288468&siteId=291194637