Git: How to undo a commit

TLDR; To undo a local commit in GIT, type $ git reset HEAD~
(that last character is a tilde, the symbol above the 6, not a dash)

If you’ve made a local commit and have not yet pushed it to a remote repository, just do $ git reset HEAD~. This will undo your commit and leave the changes unstaged.

Do $ git reset --soft HEAD~ to undo your commit but leave the changes staged (if you just need to add more changes to the commit, for example).

If you’ve already pushed your commit to a remote repo, you’ll need to revert it:


You’ll have to look up the ID, or the SHA (secure hash) for the commit you want to revert. Do this with git log:

  1. $ git log – the most recent commit is on top. The SHA in this example is a50b22ef7186d5a06248e406f18e265e3fb9b893
  2. $ git revert a50b22ef7186d5a06248e406f18e265e3fb9b893

This will likely automatically open an editor in the terminal to edit your commit message. In my case, it opens VIM. (not seen in the screenshot). You may want to add some comments explaining why you’re reverting the commit. Then save, and you’ll return to your command line, as seen in the screenshot. (To exit VIM without making changes to the commit message, just type :q <enter>).

Looping HTML5 video with jQuery


Before HTML5, browsers were not able to play video natively (that is, without the use of a plugin that must be installed and does not come with the browser). It has been common place to use Flash to deliver video content; typically with videos encoded in FLV format and played through some kind of SWF player. Although this serves its purpose, it’s still not native; users have to have the flash playback component installed in their browser to playback the content.

HTML5 introduced two new tags (among others); <video> and <audio>. These tags allow browsers to play back video/audio content natively; which also means that you have a lot more control over the content using JavaScript; for example, you can build a full featured video player using Javascript, whereas before this would have to be done in Flash.

This post will just focus on the loop attribute. I’ll be explaining browser support of video formats in another post soon.

Read More…

 Scroll to top