Search code examples
gitgit-pull

Is it possible to switch git repository branch from different folder?


Is there any way to switch the branch of some git repository from different directory?

Same like git pull

So to pull a repository from different directory I have the version of pull like this

git -C c:\MyDirectory\MyRepository pull

Is there any similar version for git switch as well?


Solution

  • Yes, of course. You use global option -C just like with git-pull.

    git -C c:\MyDirectory\MyRepository switch branch-name