Posted on Saturday 24th March 2018
There are many ways to do this task, this article like most of the git related ones on this blog are notes for reference. This was created when I got stuck with a commit which would not go away.
One way is to just reset the local repository to match the version in the remote repository. I tend to go for this one but occasonally forget the syntax.
git reset --hard origin/<branch>
git reset --hard origin/master
Similar to the above, we can set the commit we actually want to revert back to.
git reset --hard <commit hash>
One of the easiest though and often overlooked it so just delete the branch and checkout a fresh verson.
git branch -D mybranch git checkout -b origin/mybranch
Now there are other methods out there, the above are just my preferred.