Answers for "revert remote commit"

3

revert last push to server

git reset --hard HEAD@{1}
git push -f
Posted by: Guest on September-21-2020
0

how to undo a commit from remote

git reset --hard HEAD~3
git push -f
Posted by: Guest on December-22-2020
6

git undo pushed commit

git reset <previous label or sha1>
git commit -am "commit message"
git push -f <remote-name> <branch-name>  //  git push -f origin master
Posted by: Guest on March-06-2020
0

revert on remote develop

$ git reset HEAD^ --hard
$ git push mathnet -f
Posted by: Guest on November-30-2020
1

git revert remote branch

credit to: Jakub Narębski, Jeff Ferland and Charles Bailey 

// this is helpful if you have multiple devs working in a repo and they
// have pulled from dev (or whatever branch) and gotten any of the commits
// you're planning on revertting or you don't/can't know if they have pulled. 
// This will set you back to the state of the commit you want without 
// overwriting any of the history. This should help prevent conflicts

$ git reset --hard <commit hash you want to revert to>
$ git reset --soft <commit hash of last/latest commit> or @{1} 
$ git commit -m "reset: resetting back to # without overwriting history"
Posted by: Guest on January-19-2022

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language