Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to revert the last commit from the remote

# When you accidently commit  or do unnecessary commit in the remote 
// you can fix this way. 
⚠️ Warning: Your commit won't be saved.

#reset the last commit
git reset HEAD^ --hard

#force push the current changes
git push origin --force

# to save your commit 
git reset --soft HEAD~1 

#stash the changes and then force the changes
 
PREVIOUS NEXT
Tagged: #revert #commit #remote
ADD COMMENT
Topic
Name
5+1 =