git checkout branch from outside

后端 未结 5 1583
我在风中等你
我在风中等你 2021-01-31 16:18

Problem: I need somehow to checkout an existing branch of a project that is already cloned locally on my file system without being in that particular folder of this project.

5条回答
  •  你的背包
    2021-01-31 16:22

    You can use --git-dir to specify the .git directory to use as the repository, and --work-tree to specify the working tree to to the checkout in. See the git man page for details.

    git --git-dir=file-system-folder/.git --work-tree=file-system-folder checkout existing-branch
    

提交回复
热议问题