git checkout branch from outside
问题 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. Solution: I'm trying to do the following: git clone 'github-project-url' 'file-system-folder' git checkout 'existing-branch' 'file-system-folder' I do realize that second step is not quite right, but I also am trying to avoid to "cd 'file-system-folder'". 回答1: You can use --git-dir to specify the .git directory to use as