[英]ls-remote --heads origin vs ls-remote . “refs/remotes/*”
What is the difference between 有什么区别
git ls-remote --heads origin
and 和
git ls-remote . "refs/remotes/*"
? ?
The --heads origin
version takes a while to run, I guess it's updating the references from the origin. --heads origin
版本需要一段时间才能运行,我想它正在更新来自原点的引用。 The . "refs/remotes/*"
的. "refs/remotes/*"
. "refs/remotes/*"
runs instantly. . "refs/remotes/*"
立即运行。
I'd like to use these lines to git grep remote heads as in the expression below. 我想使用这些行来git grep远程头,如下面的表达式。 Which is the right one to use? 哪个是正确的?
git grep "expression" $(git ls-remote . "refs/remotes/*" | grep -v HEAD | cut -f 2)
Is it possible that the --heads origin
can return hashes which are not available locally, thus git-grep wouldn't be able to complete? 是否有可能 - --heads origin
可以返回本地不可用的哈希值,因此git-grep无法完成? In this case I guess the right one to use would be . "refs/remotes/*"
在这种情况下,我想正确使用的是. "refs/remotes/*"
. "refs/remotes/*"
with a fetch all first? . "refs/remotes/*"
首先获取全部内容?
In git ls-remote . "refs/remotes/*"
在git ls-remote . "refs/remotes/*"
git ls-remote . "refs/remotes/*"
the dot means you query your local repository to get the data. git ls-remote . "refs/remotes/*"
点表示您查询本地存储库以获取数据。
As you wrote if you use git ls-remote --heads origin
nobody guarantees that the returned hashes will be accessible locally. 正如您所写,如果您使用git ls-remote --heads origin
无人保证返回的哈希值可在本地访问。 So I think your git fetch
and then using git ls-remote . "refs/remotes/*"
所以我认为你的git fetch
然后使用git ls-remote . "refs/remotes/*"
git ls-remote . "refs/remotes/*"
is the safest option. git ls-remote . "refs/remotes/*"
是最安全的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.