This is not clear at all for me: http://git-scm.com/2010/04/11/environment.html
From what I can figure, I can't do it for individual repos. The commands are just not clear enough...
From what I can figure, I can do it like this:
GIT_DIR="directory here"
However, this seems like it's a global directory for Git repos' Git folder. Is it like this?
How exactly can I set the Git directory for only THIS repo?
Thanks for your help. If it's too stupid, I'm sorry but it's really confusing for me.
You can relocate the repository folder of any repo by replacing the .git folder with a .git file that contains gitdir: <path>. That path will be to another folder that will act as your repository folder.
NOTE: <path> contains the name of the repository folder and is not simply a path to a .git folder.
You could use this to store all repository folders in a single location with unique names. You sill execute git commands in the location of the .git file.
GIT_DIR, GIT_WORK_TREE, etc are just environment variables that, if set, are used by git. IF you set them globally they will apply globally and probably mess everything up. If they are set when you do git init it will create the repo with the appropriate config to continue working after the env are unset.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With