Reset your last GitHub commit

This blog post is a short cheat sheet. Sometimes you need to cancel your last GitHub commit before you push your changes to GitHub.

  • Using a soft reset
git reset --soft HEAD^

This blog post is a short cheat sheet to show, how to reset your commit to staged changes; this means the changed files and folders on your file system still exist, and you can work with these files and folders.

  • Using a hard reset
git reset --hard HEAD^

Example output:

HEAD is now at 58fe25da fixes

I hope this was useful to you, and let’s see what’s next?

Greetings,

Thomas

#github

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑