如何获取远程分支?

问题描述 投票:0回答:4

我意外删除了我的 git 文件夹。我正在远程分支存储库工作。 如何将远程分支拉到本地?

git gitlab
4个回答
8
投票

如果您还有 git 存储库:

就做吧

git fetch origin

其次是。

git checkout -b <branch> origin/<branch>

如果您已经完全删除了 git 存储库 然后重新克隆存储库:

git clone <repository-address>

然后,如果其他分支没有自动拉入,请按照上述步骤获取其他分支。


0
投票

我意外删除了我的 git 文件夹。我正在远程分支存储库工作。如何将远程分支拉到本地?

该怎么办?

  1. 再次克隆存储库
  2. 查看所需的分支

    # Clone the repo
    git clone <url>
    
    # Checkout the desired branch
    git checkout <branch name>
    

如果您仍然有

.git
文件夹并且没有将其删除 - 请阅读如何在此处获取代码:
如何将 HEAD 移回之前的位置? (分离头)


0
投票
git checkout -b branch_name
git pull URL branch_name

0
投票
git clone -b <branch_name> <url>
© www.soinside.com 2019 - 2024. All rights reserved.