我有一个master和一个development分支,这两个分支都推送到GitHub。我使用了cloned、pulled和fetched,但是除了master分支之外,我仍然无法获得其他任何东西。
我确信我遗漏了一些明显的东西,但我已经看过手册了,我根本就不了解joy。
发布于 2021-09-04 12:23:30
我正在从Udemy课程Elegant Automation Frameworks with Python and Pytest克隆一个存储库,这样我以后就可以通过OFFLINE查看它。我尝试下载压缩包,但这只适用于当前分支,所以这里是我的2美分。
我在Windows上工作,很明显,我求助于Windows Subsystem for Linux中的Ubuntu shell。克隆之后,下面是我的分支:
$ git clone https://github.com/BrandonBlair/elegantframeworks.git
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/config_recipe
remotes/origin/functionaltests
remotes/origin/master
remotes/origin/parallel
remotes/origin/parametrize
remotes/origin/parametrize_data_excel
remotes/origin/unittesting
remotes/origin/unittesting1然后--在尝试了几个git checkout砖墙-之后,最终对我起作用的是:
$ for b in `git branch -a | cut -c18- | cut -d\ -f1`; do git checkout $b; git stash; done在此之后,以下是我的分支:
$ git branch -a
config_recipe
functionaltests
master
parallel
parametrize
parametrize_data_excel
unittesting
* unittesting1
remotes/origin/HEAD -> origin/master
remotes/origin/config_recipe
remotes/origin/functionaltests
remotes/origin/master
remotes/origin/parallel
remotes/origin/parametrize
remotes/origin/parametrize_data_excel
remotes/origin/unittesting
remotes/origin/unittesting1我的是物理的,去掉了初始的remotes/origin/,然后过滤掉空格分隔符。可以说,我可以只用一个cut就完成grep HEAD,但我将把它留给评论。
请注意,您当前的分支现在是列表中的最后一个分支。如果你不知道为什么会这样,那你就有麻烦了。现在只需git checkout你想要的任何东西。
https://stackoverflow.com/questions/67699
复制相似问题