2

This question is somewhat related to this question: Is it possible to have a git repo inside another git repo

Here is the summary:

I had a git repo, which I pushed to my web host. I seperated a subdirectory of that repo, and added that subdirectory back as submodule. Now I am going to remove that subdirectory from my web host, create an empty git repository there, and push my submodule there. So, I was wondering what does --bare switch do, and do I need it.

As a side note, I am git beginner.

Community
  • 1
  • 1
yasar
  • 13,158
  • 28
  • 95
  • 160

2 Answers2

3

The --bare switch makes it so that the repository has no working directory; you will be unable to check out any branches or manipulate files directly.

Without --bare the repository data will be created in $REPO_ROOT/.git. With --bare the repository data will be created in $REPO_ROOT.

You'd typically use this option when the purpose of the repository is to serve as a clone/push/pull point for other repositories.

cdhowie
  • 158,093
  • 24
  • 286
  • 300
1

the --bare switch stops the repo having conflicts between local usage and distant usage. It makes everyone use it remotely, and so avoids any confusion between temporary working files and completed committed branches and trees.

Philip Oakley
  • 13,333
  • 9
  • 48
  • 71