Answers for "change current branch git"

10

how to swap branch git

[git checkout "branch_name"]

is another way to say:

[git checkout -b branch_name origin/branch_name]

in case "branch_name" exists only remotely.

[git checkout -b branch_name origin/branch_name] is useful in case you have multiple remotes.

Regarding [git checkout origin 'another_branch'] I'm not sure this is possible, AFAK you can do this using "fetch" command -- [git fetch origin 'another_branch']
Posted by: Guest on February-17-2020
2

change current branch git

#check if branch exists
$ git branch
#switch to branch
$ git checkout <existing_branch>
#add new branch
$ git checkout -b <new_branch>
Posted by: Guest on July-15-2021
0

git toggle between branches

Toggle between two git branches: git checkout -
Posted by: Guest on November-03-2020

Code answers related to "change current branch git"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language