"git --bare init" does not create just the .git directory

This is confusing. I've read in many places that it git --bare init

sets the directory where you run the command from a yearly Git repository, the type you want to use as your central repository. In particular, I'm reading where this command creates just an empty subdirectory .git

. When I run this command from a GitGui bash window, I get multiple directories created, none of which are .git

. Conversely, if I run git init

, I get the directory .git

and all those created using the parameter --bare

. Is there something wrong with my bash tool?

+3


source to share


2 answers


The recommended use git init --bare

is to specify the name of the directory where the bare repository is stored. For example. git init --bare myproject.git

(common practice is for open vaults to end in .git

). This will create a new folder myproject.git

and put all the Git stuff in it.

If you leave the name of the repository outside the command, Git initializes the current directory as a (bare) repository. Thus, it will place all the necessary things in the current folder.



So what you see is the correct result and all of these files are necessary and required for the bare repository.

+5


source


All of these directories you see are directories that are usually found inside .git. Since there is no working copy, there is no need to strip out regular files from files in .git, so there is no unnecessary .git subdirectory.



+4


source







All Articles