我从Github上fork了一个仓库。运行 git remote -v
命令后,它会显示:
origin https://github.com/myusername/moodle.git (fetch)
origin https://github.com/myusername/moodle.git (push)
upstream https://github.com/moodle/moodle.git (fetch)
upstream https://github.com/moodle/moodle.git (push)
moodle.git
大约有10个分支,但仓库只显示其中的2个。通过执行git branch -a
(显示所有分支)命令,我得到以下结果:
MOODLE_24_STABLE// just these two on local..how?
* master//
origin/MOODLE_13_STABLE
origin/MOODLE_14_STABLE
origin/MOODLE_15_STABLE
origin/MOODLE_16_STABLE
origin/MOODLE_17_STABLE
origin/MOODLE_18_STABLE
origin/MOODLE_19_STABLE
origin/MOODLE_20_STABLE
origin/MOODLE_21_STABLE
origin/MOODLE_22_STABLE
origin/MOODLE_23_STABLE
origin/MOODLE_24_STABLE
origin/master
upstream/MOODLE_13_STABLE
upstream/MOODLE_14_STABLE
upstream/MOODLE_15_STABLE
upstream/MOODLE_16_STABLE
upstream/MOODLE_17_STABLE
upstream/MOODLE_18_STABLE
upstream/MOODLE_19_STABLE
upstream/MOODLE_20_STABLE
upstream/MOODLE_21_STABLE
upstream/MOODLE_22_STABLE
upstream/MOODLE_23_STABLE
upstream/MOODLE_24_STABLE
upstream/master
我如何在不丢失数据或出现任何异常情况的情况下解决我的问题?
git checkout -b STABLE_23_STABLE
,但是文件不是该分支的那些文件。 - xangit checkout -b MOODLE_23_STABLE
创建一个新的分支,基于当前提交,因此您仍将看到相同的提交记录。可以使用git checkout -b MOODLE_23_STABLE upstream/MOODLE_23_STABLE
或git checkout MOODLE_23_STABLE
(简写/DWIM 语法)来完成。 - knittl