News for hackers. Stuff that matters.
Re:Why was '~' chosen to represent the home directory? by CodyJung on Sunday November 24, 2013 @09:04PM (#6792134)
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?
Re:Why was '~' chosen to represent the home directory? by djur on Sunday November 24, 2013 @09:48PM (#6792247)
HEAD~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/gitrevision...

Re:Why was '~' chosen to represent the home directory? by mstromb on Sunday November 24, 2013 @09:26PM (#6792187)
Git 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.