Search code examples
gitcommand-linebranchgit-pullpull

how to pull a branch in repository?


so I have some repository, in that repo have master and other branches ( or we can call branch a, branch b, branch c)

I want to pull branch C, how can I do that?

I'm using command line and git


Solution

  • Try and use git switch, not the old obsolete and confusing git checkout command.

    git fetch
    git switch c
    

    That is because, from guess mode:

    If <branch> is not found but there does exist a tracking branch in exactly one remote (call it <remote>) with a matching name, treat as equivalent to

    git switch -c <branch> --track <remote>/<branch>