I’m working on a git project with a partner. I made some changes, then accidentally added and committed more files than I intended to and pushed them to the master repository. How do I rollback the remote repository to the last commit, BUT preserve my local copy so I can re-add and commit correctly?
Share
You can tell
git pushto push the remote to a specific revision:Explanation:
originis the name of the remote repoHEAD~1is the source-refspec – the revision to push.HEAD~1means one commit behind the current localHEAD.masteris the target-refspec – the remote branch to push to.