git相当于hg -R?

时间:2015-02-23 02:53:03

标签: git mercurial

hg -R相当的git是什么?我想在没有植根于当前工作目录的父目录的存储库上运行。

到目前为止,我有git --git-dir="$a/.git" --work-tree="$a" diff "$a",其中$a是git存储库目录。

1 个答案:

答案 0 :(得分:4)

你有什么应该工作。如果您使用git 1.8.5或更高版本,更简单的替代方法是使用-C标志,如下所示:

git -C "$a" diff

从手册页:

-C <path>
           Run as if git was started in <path> instead of the current working directory. When multiple -C options are given, each subsequent
           non-absolute -C <path> is interpreted relative to the preceding -C <path>.