Vladimir Varankin
1 min readAug 27, 2017


Tonight I found out git’s --separate-git-dir flag.

An abstract from the git-init / git-clone man pages:

--separate-git-dir=<git dir>

Instead of initializing the repository as a directory to either $GIT_DIR or ./.git/, create a text file there containing the path to the actual repository. [..]

There are two facts that riveted me:

1. The well-known .git/ directory, that usually leaves inside your project’s root, can be replaced with a simple text file named, you guessed it, .git:

gitdir: /absolute/path/to/projects/bare/clone.git

2. One can place a cloned bare repository on an external volume, which is automaticaly synced (I’m used to Yandex.Disk) between dev stations.

Runnig git clone --separate-git-dit=/... or git init --saparete-git-dir=/... gives me an easy way to keep my own repositories private, while leaves the power of distributed source-code managment.

Another possible application might be to have a lightweight temporary copy of a project, which could be a common case for CI jobs of scripts.