Storing a single file all by itself
This intermediate trick allows you to store a single file into a git repository without the file being in any of the branches.First of all, let's create a new file:
echo "Hi" > message.txtand store it in git:git hash-object -w message.txt
b14df6442ea5a1b382985a6549b85d435376c351At this stage, the file is stored within the git repository but there is no other way to get to it other than using the hash:git cat-file blob b14df6442ea5a1b382985a6549b85d435376c351
HiA good way to point to the stored contents is to use a tag:git tag message.txt b14df6442ea5a1b382985a6549b85d435376c351Now you can access your file this way:git cat-file blob message.txt
HiCreating an empty branch
As seen in this git screencast or in the Git Community Book, you can create a branch without a parent or any initial contents:git symbolic-ref HEAD refs/heads/foo
rm .git/index
git clean -fdxTo finish it off, add what you were planning on storing there and commit it:git add myfile
git commit -m 'Initial commit'


