git ls-remote -h

正确命令及作用

git ls-remote --heads <远程仓库URL>
# 或简写为
git ls-remote -h <远程仓库URL>

输出示例

$ git ls-remote -h https://github.com/user/repo.git
a1b2c3d... refs/heads/main
e4f5g6h... refs/heads/dev

每行显示一个分支的 提交哈希 和 完整引用路径

posted @ 2025-04-28 16:27  山村放羊娃  阅读(24)  评论(0)    收藏  举报