What is a bare Git repository?

I have started a quest to know more in depth detail about the tool that I have been using every day for the last couple of years. I have wanted to understand more about Git so I am reading the documentation a little bit at a time.

Looking at the init method I noticed there was a --bare switch you could pass to it.

  --bare
  Create a bare repository. If GIT_DIR environment is not set, it is set to the current working directory.

What does that mean? No information is provided to determine what the difference is between a normal and a bare repository. The documentation had failed me.

I had to look outside of the documentation to find an answer to this. I could have used this as an excuse to take the time and look at the source code for Git and figure out what the differences are but I just did not have the time. I found a blog post written by Jon Saints who at some point had the same question as me. His post summarized that the bare repo did not contain the working copy of your code. The bare repo is merely a shell for the delta and changes made by you and other developers and it is meant ot be housed on the central server.

I am still unclear on how that use cas would find its way into my day to day workflow. I don't think that I will ever diretly house my own git repositories for updating. I would much rather use a service like Github or Bitbucket for that.

I guess I can chaulk this up to the "Good to know" but not really relavant category. If you happent to have any real world use cases I would love to hear about them. Feel free to contact me.

Categories

git

Comments