I just ran the following commands on my rails project:
git init
git add .
git commit -a -m 'Initial'
Where does git actually store this repository? (it's on my local machine, but where?)
Thanks!
I just ran the following commands on my rails project:
git init
git add .
git commit -a -m 'Initial'
Where does git actually store this repository? (it's on my local machine, but where?)
Thanks!
It will create your repository in the .git
folder in the current directory.
In the root directory of the project there is a hidden .git
directory that contains configuration, the repository etc.
In a .git directory in the root of the project. Unlike some other version control systems, notably CVS, there are no additional directories in any of the subdirectories.
To be a bit more complete, Git works with:
git init
).git
, which will store the revisions of all your files)GIT_DIR
is an environment variable, which can be an absolute path or relative path to current working directory.
If it is not defined, the "path to the git repository" is by default at the root directory of your working tree (again, where you made a git init
).
You can actually execute any git command from anywhere from your disk, provided you specify the working tree path and the git repository path:
git command --git-dir=<path> --work-tree=<path>
But if you execute them in one of the subdirectories of a git repo (with no GIT-DIR or working tree path specified), git will simply look in the current and parent directories until it find a .git
, assume this it also the root directory of your working tree, and use that .git
as the only container for all the revisions of your files.
Note: .git
is also hidden in Windows (msysgit).
You would have to do a dir /AH
to see it.