我在 GitHub 上 pull 了一个有多个分支的项目,但忘了是哪个分支了。如何确定我 pull 的是哪个 fork ?
最佳答案
只获取远程URL:
git config --get remote.origin.url
如果您需要完整输出,并且您所在的网络可以到达源所在的远程仓库:
git remote show origin
当使用 git clone
(来自 GitHub 或与此相关的任何源存储库)时,克隆源的默认名称是“origin”。使用 git remote show
将显示有关此远程名称的信息。前几行应显示:
C:\Users\jaredpar\VsVim> git remote show origin
* remote origin
Fetch URL: git@github.com:jaredpar/VsVim.git
Push URL: git@github.com:jaredpar/VsVim.git
HEAD branch: master
Remote branches:
如果您想在脚本中使用该值,您将使用此答案中列出的第一个命令。
关于git - 如何确定本地 Git 存储库最初从中克隆的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4089430/