与hg -R
相当的git是什么?我想在没有植根于当前工作目录的父目录的存储库上运行。
到目前为止,我有git --git-dir="$a/.git" --work-tree="$a" diff "$a"
,其中$a
是git存储库目录。
答案 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>.