As with undo, redo can mean a lot of things. In this context, redoing a commit will mean creating almost the same commit again with the same parent(s) as the previous commit, but with different content and/or different commit messages. This is quite useful if you've just created a commit but perhaps have forgotten to add a necessary file to the staging area before you committed, or if you need to reword the commit message.
Again, we'll use the
hello world repository. Make a fresh clone of the repository, or reset the
master branch if you have already cloned.
We can create a fresh clone as follows:
$ git clone https://github.com/dvaske/hello_world_cookbook.git $ cd hello_world_cookbook
We can reset an existing clone as follows:
$ cd hello_world_cookbook $ git checkout master $ git reset --hard origin master HEAD is now at 3061dc6 Adds Java version of 'hello world'