Skip to content

Instantly share code, notes, and snippets.

@directorscut82
Created February 1, 2018 08:16
Show Gist options
  • Select an option

  • Save directorscut82/ce3120168f080d6bb0a012523f21595e to your computer and use it in GitHub Desktop.

Select an option

Save directorscut82/ce3120168f080d6bb0a012523f21595e to your computer and use it in GitHub Desktop.
[Perform the following steps to DELETE/REVERT Commits Locally+Remotely] #GIT
Perform the following steps to DELETE/REVERT Commits Locally+Remotely
First Locally Reverting to commit <id>
git reset --hard <id>
followed by
git clean -f -d
These two commands clean force reset to commit stage <id> as shown below in snapshot
now if you run git status then you'll see that you are TWO Commits BEHIND from the remote branch
Run following to update your indexes (if there are any updates). It is recommended that you ask all developers not to accept any pull requests on main remote branch.
git fetch --all
Once you are done with it then you are required to Push this commit forcefully by using + symbol in-front of branch as shown below. I have used here as master branch, you can replace it with any
git push -u origin +master
now if you see the web interface of remote then commit there should be reverted as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment