From b838720631f0867c42a00c63dde86d133eadebeb Mon Sep 17 00:00:00 2001 From: Tatsujinichi Date: Wed, 15 Nov 2017 23:08:04 +0900 Subject: [PATCH] Be more specific about HEAD^ vs HEAD~ (#122) * Be more specific about HEAD^ vs HEAD~ * add more * revise again --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08dee03..10356d0 100644 --- a/README.md +++ b/README.md @@ -383,7 +383,13 @@ Reset the branch master to the previous commit: (master)$ git reset --hard HEAD^ ``` -`HEAD^` is short for `HEAD^1`. You can reset further through the generations by specifying which `HEAD` to set to. +`HEAD^` is short for `HEAD^1`. This stands for the first parent of `HEAD`, similarly `HEAD^2` stands for the + +second parent of the commit (merges can have 2 parents). + +Note that `HEAD^2` is **not** the same as `HEAD~2` + +(see [this link](http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde) for more information). 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.