Skip to content

Commit b838720

Browse files
TatsujinichiRichardLitt
authored andcommitted
Be more specific about HEAD^ vs HEAD~ (k88hudson#122)
* Be more specific about HEAD^ vs HEAD~ * add more * revise again
1 parent b244c00 commit b838720

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,13 @@ Reset the branch master to the previous commit:
383383
(master)$ git reset --hard HEAD^
384384
```
385385

386-
`HEAD^` is short for `HEAD^1`. You can reset further through the generations by specifying which `HEAD` to set to.
386+
`HEAD^` is short for `HEAD^1`. This stands for the first parent of `HEAD`, similarly `HEAD^2` stands for the
387+
388+
second parent of the commit (merges can have 2 parents).
389+
390+
Note that `HEAD^2` is **not** the same as `HEAD~2`
391+
392+
(see [this link](http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde) for more information).
387393

388394
Alternatively, if you don't want to use `HEAD^`, find out what the commit hash you want to set your master branch to (`git log` should do the trick). Then reset to that hash. `git push` will make sure that this change is reflected on your remote.
389395

0 commit comments

Comments
 (0)