relocating the .git folder
I don't think this is possible without a bit of hacking but just throwing it out there.
In Git is it possible to relocate the bulk of the .git folder (/objects i assume) to another location. I am having a problem without my current hard drive filling up with git and i want to be able to move it to a separate hard drive to free up space.
There are three possibilities I can think of:
GIT_DIR
environment variable tells Git where to look for the repository. The default is .git
, obviously, but you can also set it to /some/where/else
, if you want. GIT_OBJECT_DIR
environment variable does the same, but just for the .git/objects
subdirectory, not the whole repository. .git/objects/info/alternates
or the environment variable $GIT_ALTERNATE_OBJECT_DIRECTORIES
to "borrow" objects from another repository. See the git-repositorylayout(5) manual page for details.
Git has a command line option called --git-dir
. Whenever you run git, use the --git-dir
option.
git --git-dir=a_different_git_directory status
Perhaps you could put that in a batch file or something to make your life easier.
Usually the .git directory isn't that big. When is the last time you did a garbage collection?
git gc
This cleans up unreferenced objects in the git store.
链接地址: http://www.djcxy.com/p/18880.html下一篇: 重新定位.git文件夹