Blankman
Blankman

Reputation: 267160

Is 'git --bare init' wrong?

Is git --bare init wrong?

Should it be:

git init --bare

Upvotes: 5

Views: 6499

Answers (3)

Faysal Kabir
Faysal Kabir

Reputation: 21

to initialize a d git repository the best command i am using is

git init --bare .

before execute this command make sure you are inside in your directory which one you want to create repository.

Upvotes: 2

earl
earl

Reputation: 41805

git --bare init is not wrong, it is just a different way to express the same (bugs notwithstanding) operation.

As a quick look at the toplevel git(1) manpage will confirm, --bare is a global option for all Git commands which affects how the repository directory is discovered:

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

Originally, this was the only way to have git commands operate in "bare mode", which is why you'll find git --bare init in quite a lot of the older documents/tutorials. --bare as separate option was added in the 1.5.6 series, to improve the CLI.

Upvotes: 19

William Briand
William Briand

Reputation: 864

From a semantical point of view, git init --bare is better : --bare is related to init, not the entire git.

Upvotes: 5

Related Questions