3 ms·
FWIW, Mercurial has this - there's a notional changeset called 'null' whose hash is all zeroes, which is the parent of every changeset which does not have a rea
by twic 10y ago
FWIW, Mercurial has this - there's a notional changeset called 'null' whose hash is all zeroes, which is the parent of every changeset which does not have a real parent. As a result, you can rebase a root changset. For example:
$ hg init
$ echo silver >colour
$ hg add colour
$ hg commit --message 'First commit'
$ hg checkout null
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo liquid >state
$ hg add state
$ hg commit --message 'Second commit'
created new head
$ hg log --template '{rev} = {node|short} child of {p1node|short}: "{desc}" @ {date|isodate}\n'
1 = 99f1472f8a69 child of 000000000000: "Second commit" @ 2016-10-02 17:29 +0100
0 = 6433a3e95c3d child of 000000000000: "First commit" @ 2016-10-02 17:29 +0100
$ hg rebase --source 0 --dest 1
rebasing 0:6433a3e95c3d "First commit"
saved backup bundle to /path/to/repo/.hg/strip-backup/6433a3e95c3d-331b8224-backup.hg
$ hg log --template '{rev} = {node|short} child of {p1node|short}: "{desc}" @ {date|isodate}\n'
1 = b9951882336f child of 99f1472f8a69: "First commit" @ 2016-10-02 17:29 +0100
0 = 99f1472f8a69 child of 000000000000: "Second commit" @ 2016-10-02 17:29 +0100
- kazinator 10y agoI was thinking exactly the same thing: why doesn't git use an all-zero hash as a special NIL. I think SHA-1 cannot output all zeros as a valid hash.