I am going through some Git tutorials. The concept of a "working directory" keeps being mentioned, however, none of the tutorials or documents I read points out where or what this "working directory" is.
I have thought that it was actually the .git
's parent directory, a.k.a the directory I run git init
in. But the video tutorial I am watching talks about the state of nothing to commit and "working directory clean":
In fact you can actually make a copy of the repository, and make that copy so that it does not have a working directory, this is actually called the bare clone. This is actually what GitHub uses.
If my understanding of the "working directory" is correct, how can a repository not have a "working directory"? And what does it mean, when it says that GitHub uses a "bare clone"?
This should hopefully clear things up for us:
What is the difference between a repository created using the git init command and the git init --bare command?
Repositories created with the git init command are called working directories. In the top level folder of the repository you will find two things:
A .git subfolder with all the git related revision history of your repo A working tree, or checked out copies of your project files.
Repositories created with git init --bare are called bare repos. They are structured a bit differently from working directories. First off, they contain no working or checked out copy of your source files. And second, bare repos store git revision history of your repo in the root folder of your repository instead of in a .git subfolder. Note… bare repositories are customarily given a .git extension.
Taken from John Saints - What is a bare git repository?
A bare git clone does not contain a working directory of checked out code, in other words.
Think of it as just the .git
directory (the Git database) without anything else.