有没有办法确定我的本地克隆是否是某个github存储库的分支? [英] Is there a way to determine if my local clone is a fork of some github repo?

查看:58
本文介绍了有没有办法确定我的本地克隆是否是某个github存储库的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更具体地说,如何确定磁盘上的回购源头是某个回购的分支?我认为这应该是一些API调用,但是我不确定.我可以依靠"remote.upstream.url"吗?

More specifically, how do I tell if the origin of the repo on disk is a fork of some repo? I am thinking that it should be some API call, but I am not sure. Can I rely on "remote.upstream.url"?

推荐答案

您可以将 GitHub API用于存储库获取特定的存储库

GET /repos/:owner/:repo

(您可以在命令行中使用 curl调用)

(you can use a curl call from command line)

JSON答案将包含"fork"字段:值为true或false.

The JSON answer will include a "fork" field: value true or false.

这篇关于有没有办法确定我的本地克隆是否是某个github存储库的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆