Get your local branch to match the online repository i.e. online repo -> local
git fetch origin
git reset --hard origin/master
https://stackoverflow.com/a/36177806/7082 (Undo stuff that has been already pushed) I have a project in a remote repository, synchronized with a local repository (development) and the server one (prod). I've been making some commited changes already pushed to remote and pulled from the server. Now, I want to undo those changes. So I could just git checkout to the commit before the changes and commit the new changes, but I'm guessing that there will be problems to push them again to remote. Any suggestion on how should I proceed?
In the server, move the cursor back to the last known good commit:
git push -f origin <last_known_good_commit>:<branch_name>
Locally, do the same:
git reset --hard <last_known_good_commit>
#         ^^^^^^
#         optional
I have just made a commit (not pushed online) - but I want to uncommit it - because either I need to add more files or I committed it to the wrong branch.
git reset --soft HEAD^
More info: https://stackoverflow.com/questions/2845731/how-to-uncommit-my-last-commit-in-git