It should use the following command, if it does not have the branch on the local machine:
git checkout --track -b <apelido_do_branch_local> <apelido_do_repositório_remoto>/<apelido_do_branch_remoto>
The --track
flag links the local repository to the remote and the -b
flag tells git that a new branch must be generated because the checkout
command has other functions.
This command will create a new branch
local equal to the remote with the nickname <apelido_do_branch_local>
Example: my remote repository in GitHub is https://github.com/luizfilipe/repositorio
in my local repository it is mapped to the nickname origin
, I want to bring the new branch created with nickname branch1
.
The command to be executed will be:
git checkout --track -b branch1local origin/branch1
If it already has the local branch it should use:
git pull <apelido_do_repositório_remoto> <apelido_do_branch_local>
example: my remote repository in GitHub is: https://github.com/luizfilipe/repositorio
in my local repository it is mapped to the nickname origin
, I want to bring up the branch of nickname branch1
, inside branch1local
I use the command:
git pull origin branch1