Most of the time in git you will be creating branches of your main project and working on them. What if you wanted to create a ‘documentation’ branch or something? It doesn’t really deserve it’s own repository because it’s so closely related. The git project repository does this. The git project repository has separate branches for master, docs and man pages etc too. Here’s how you do it.
Go into your git project and type
git symbolic-ref HEAD refs/heads/empty
git rm -rf *
echo 'New blank branch' >README
git add README
git commit -m 'New blank branch'
That’s it - now you have a new branch ‘empty’.
Posted on March 31st, 2008 by dysinger
Filed under: @work