2009-04-01

How to create an empty Git branch

(Source: Empty Branches)

Create a new symbolic reference:

git symbolic-ref HEAD refs/heads/<newbranch>

Empty the index:

git rm --cached -r .

Empty the working copy (watch out!):

rm -r * .gitignore

Commit the empty branch:

git commit --allow-empty -m'initial empty branch'

Because .gitignore is under Git control, this file can have different content depending on the current branch, so if you have e.g. your project’s homepage in a branch of your source repository, the website’s .gitignore can be different than the one from the source branch.

09:08 [/software]

bvg@six-card-solutions.com

Hey Bärni, ich wünsche dir einen guten Start bei deinem neuen Brötchengeber!

08:58 [/allgemein]