没有.git文件夹的git - 一个远程的git-dir [英] git without .git folder -- a remote git-dir
问题描述
这个问题比任何实际问题都出于好奇,但是我能否有效地让我的$ GIT_DIR成为git://example.com/repo.git/?所以没有.git文件夹 - 每一个提交等都会经历网络开销。
编辑:
一个潜在的用例可能是试图做一个简单的导出像svn,但事实证明,问题是回答 here
$ GIT_DIR
,于2005年5月推出,适用于:
- 同时指定
SHA1_FILE_DIRECTORY
(状态GIT_OBJECT_DIRECTORY
,即$ GIT_DIR / objects
)
-
GIT_INDEX_FILE
($ GIT_DIR / index
)
当未定义GIT_DIR时,它默认为 .git
。
它是一个到当前工作目录的绝对路径或相对路径,而不是http或git绝对路径。
有些命令在后面的例子中不起作用。
例如, git diff< one-tree>
(代表一种方法来区分当前工作树的部分给定的树)会失败。
注意:这与 git diff
不同,它与索引相同。
使用这些命令(以及在工作树之外没有 GIT_DIR
的情况下运行时出错的其他命令),您真的应该是 中的您感兴趣的子目录。
。
This question is asked out of curiosity more than for anything practical, but can I effectively have my $GIT_DIR be git://example.com/repo.git/ ? So there would be no .git folder -- every single commit, etc would go through the network overhead.
edit: One potential use case might be for trying to do a simple "export" like svn, but it turns out that question is answered here
$GIT_DIR
, introduced in May 2005, is for:
- specifying both
SHA1_FILE_DIRECTORY
(wasGIT_OBJECT_DIRECTORY
, i.e. "$GIT_DIR/objects
") GIT_INDEX_FILE
("$GIT_DIR/index
")
When GIT_DIR is not defined, it defaults to ".git
".
It is meant to be an absolute path or relative path to current working directory, not an http or git absolute path.
Inspired by this post from Junio C. Hamano:
Some commands would not work in the later case.
For instance, "git diff <one-tree>
" (representing a way to diff the part of work tree you are currently in with the given tree) would fail.
Note: this is not like "git diff
" , which does the same with the index.
With these commands (and others that error out when you run without GIT_DIR
outside the work tree), you are really expected to be in the subdirectory you are interested in.
.
这篇关于没有.git文件夹的git - 一个远程的git-dir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!