What I did, when I wanted to "initialize" some more-or-less empty branches was to have a single file in all of them. Called, cleverly, branch
git init echo 'master' >branch git add . git commit -m 'master' git checkout --orphan b2 echo 'b2' >branch git add . git commit -m 'b2' # and so on And, if nothing else, I could have a script which could easily determine the branch that was active by looking a the value in the file "branch". Yes, I'm a bit strange. On Thu, Jun 6, 2013 at 4:02 PM, Thomas Ferris Nicolaisen <tfn...@gmail.com>wrote: > On Thursday, June 6, 2013 8:51:50 PM UTC+2, Dale Worley wrote: > >> When you want to create a new branch that has no ancestors, you use >> "git checkout --orphan" to set the repository in a state where the >> next commit will have no parents. However, it appears that one can >> only do "git checkout --orphan" only if the *current* state will *not* >> create an orphan commit. This makes no sense, because the current >> repository state has nothing to do with setting up the next state. >> >> Here is a script that shows the problem: >> >> $ git --version >> git version 1.7.7.6 >> >> $ # Make a test directory. >> $ DIR=temp.$$ >> $ mkdir $DIR >> $ cd $DIR >> >> $ # Create a new repository. >> $ rm -rf .git >> $ git init >> Initialized empty Git repository in >> /common/home/worley/git-**checkout/temp.19517/.git/ >> >> >> $ # Try to create an orphaned branch. This fails. >> $ git checkout --orphan first-new-branch >> fatal: You are on a branch yet to be born >> >> $ # Create a commit on branch master. (We are still on master.) >> $ git commit --allow-empty -m 'Empty commit.' >> [master (root-commit) db3f0dd] Empty commit. >> >> $ # Try to create an orphaned branch. This succeeds. >> $ git checkout --orphan second-new-branch >> Switched to a new branch 'second-new-branch' >> >> $ # Show the Git status. >> $ git branch >> master >> $ cat .git/HEAD >> ref: refs/heads/second-new-branch >> >> $ # But now we can't create another orphaned branch! >> $ git checkout --orphan third-new-branch >> fatal: You are on a branch yet to be born >> $ >> > > > Repos (or branches) without history are funny places where a lot of > operations make less or more sense. The place to address this is the Git > developer mailing list, but the use-case does sound a bit, well, pointless. > I'm sure it will help if you present them with a valid use-case that this > is important to fix: https://gist.github.com/tfnico/4441562 > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to git-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- This is a test of the Emergency Broadcast System. If this had been an actual emergency, do you really think we'd stick around to tell you? Maranatha! <>< John McKown -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.