I believe this tip will useful for all who use git and want to know more about git internal details.
I aimed to create minimal valid ".git" directory. At the end of my steps, "
git status" command should be happy with handmade structure of ".git" directory.
Internal details are very useful to keep in mind when using Git.
First of all, create "repo" directory. Inside this directory, we will create several folders and one file. And after that, git will be satisfied.
Before start, we ask git about "
repo" with "
We get the following answer:
fatal: Not a git repository (or any of the parent directories): .git
As you can see, git isn't happy.
So we will try to make git happy about our directory.
- Create ".git" directory inside "repo". Our repository will located here.
- Create "objects" directory inside ".git". This directory will contain our commits.
- Create "refs" directory inside ".git". This directory will contain branches.
- And last one but not the least. Create file "HEAD" inside ".git" with content "ref: refs/heads/master". This is a pointer on current branch.
It's all what we need.
Ask again git about "repo".
Git's answer on it.
On branch master
nothing to commit (create/copy files and use "git add" to track)
Git now happy!
We've created git repository without "
- 27.12.2015 Initial version