Any donation is very welcome
Fork me on GitHub

I. Git tips

4. Reset a branch on a precise commit

It can happen sometimes that you might want to just remove your last changes. That's where git reset --hard comes in.

Get the commit you want to start from

So let's start by finding out what the commit id is:

git log

Copy the commit id (the highlighted part below):

Git log

Then just reset your local branch on this commit:

git reset --hard 1f51df83b0c634cbb1c55d6e426f0b9804b72df6

Of course, you need to put your own commit id instead of mine.

If you want/need to push the changes on the repository. Once again, I warn you (like I already did in the previous chapters): we'll use the force-push option so be very careful!

git push -f origin HEAD:the_branch_I_want_to_push_on

That's it!