3 ms·
Minor correction: there does not have to be at least one parent commit. A commit can have no parent. The root commit, for example, should be parentless. A repo
by tzs 16y ago
Minor correction: there does not have to be at least one parent commit. A commit can have no parent. The root commit, for example, should be parentless.
A repository can have more than root. For instance, I have a repository that was formed from merging two separate repositories. From a code history point of view, the two repositories are unrelated, so in the merged repository each has its own root.
- psadauskas 16y agoGithub also takes advantage of this; if you make an empty branch called "gh-pages", and put static html (and css, js) in it, Github will host them for you. I've also used it to greenfield some ideas in the same project. Its a bit of a hack to create one, though: git symbolic-ref HEAD refs/heads/newbranch rm .git/index git clean -fdx <do work> git add your files git commit -m 'Initial commit' (From http://book.git-scm.com/5_creating_new_empty_branches.html http://book.git-scm.com/5_creating_new_empty_branches.html)
- davvid 16y agoThe community git book will often do things "the old fashioned way" to keep compatibility with older versions of git. Modern versions of git let you do this instead: git checkout --orphan new-branch