4 ms·
Oh! Is this also why, when using git, HEAD~1 and HEAD^1 are equivalent? Or is it coincidence that they're on the same key?
by CodyJung 13y ago
Oh! Is this also why, when using git, HEAD~1 and HEAD^1 are equivalent? Or is it coincidence that they're on the same key?
- mstromb 13y agoGit was released in 2005, so while it's probably not a coincidence it most likely has nothing to do with a keyboard from the 70s.
- deleted 13y ago[deleted]
- djur 13y agoHEAD~1 and HEAD^1 are equivalent, but HEAD~n and HEAD^n aren't. HEAD~n means "the n-parent of HEAD, always choosing the first parent." So HEAD~3 means the first parent of the first parent of the first parent of HEAD. HEAD^n means "the nth parent of head". git commits can have multiple parents if they are merges. So HEAD^3 means the third parent of HEAD. As a result, HEAD~1 means "the first parent of HEAD" and HEAD^1 means "the first parent of HEAD", but the 1 means two completely different things. The gitrevisions manpage is pretty mindblowing: https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html https://www.kernel.org/pub/software/scm/git/docs/gitrevision...