gpt4 book ai didi

git - ls-remote --heads 起源与 ls-remote 。 "refs/remotes/*"

转载 作者:太空狗 更新时间:2023-10-29 13:38:22 25 4
gpt4 key购买 nike

有什么区别

git ls-remote --heads origin

git ls-remote . "refs/remotes/*"

?

--heads origin 版本需要一段时间才能运行,我猜它正在更新来自 origin 的引用。 。 “refs/remotes/*” 立即运行。

我想使用这些行来 git grep remote heads,如下面的表达式所示。哪个才是正确的使用方式?

git grep "expression" $(git ls-remote . "refs/remotes/*" | grep -v HEAD | cut -f 2)

--heads origin 是否可能返回本地不可用的哈希值,因此 git-grep 无法完成?在这种情况下,我想正确使用的是 。 “refs/remotes/*” 首先获取全部?

最佳答案

git ls-remote 中。 “refs/remotes/*” 点表示您查询本地存储库以获取数据。

如您所写,如果您使用 git ls-remote --heads origin 没有人保证返回的哈希值可以在本地访问。所以我认为你的 git fetch 然后使用 git ls-remote 。 “refs/remotes/*” 是最安全的选择。

关于git - ls-remote --heads 起源与 ls-remote 。 "refs/remotes/*",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22460054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com