Skip to content

Conversation

Tatsujinichi
Copy link
Contributor

The text as it is kind of implies that HEAD^2 would be equivalent to HEAD~2. I think it it worth adding a little more detail here.

@RichardLitt
Copy link
Collaborator

Fair. I think this needs a little bit more - can you add a sentence showing that HEAD~2 points to the first parent's first parent, while HEAD^2 specifies the first parent's second parent?

More on this: http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde

@Tatsujinichi
Copy link
Contributor Author

My impression is that this document is not a substitute for the official documentation. But should be
a sparse cheat sheet with short solutions to common problems. Therefore I should not be overly verbose. I think this is already on the borderline of saying too much.

@RichardLitt
Copy link
Collaborator

Hmm. Fair. @k88hudson What do you think?

@drj11
Copy link

drj11 commented Nov 13, 2017

Now I've learnt (thanks @RichardLitt ) about the difference between thing^ and thing~ I think that it's never worth teaching novices HEAD^ and I should only ever use HEAD~.

In particular: HEAD~~ is the same as HEAD~2 and is often useful (the grandparent). HEAD^^ (grandparent) is not the same as HEAD^2 (second parent when it exists) and I think the difference will only confuse novices.

@k88hudson
Copy link
Owner

@Tatsujinichi @RichardLitt Personally, I wouldn't go with an extended explanation with examples here, I'd just briefly mention that HEAD~2 is not equivalent to HEAD^2. Something like:

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:....) for more information).

Even without the link, I think that would give folks enough context for further googling if necessary.

@RichardLitt RichardLitt merged commit b838720 into k88hudson:master Nov 15, 2017
@RichardLitt
Copy link
Collaborator

Thanks @Tatsujinichi!

aroup pushed a commit to aroup/git-flight-rules that referenced this pull request Jan 17, 2020
* Be more specific about HEAD^ vs HEAD~

* add more

* revise again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants