Q:

git change branch

git switch <branch_name>

git checkout <branch_name> 
14
git branch -a # it will show an astrick * like *master
git branch --show-current # source == git remote --help
1
[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']
9
$ git checkout <existing_branch>

$ git checkout -b <new_branch>
12
git checkout <<branchName>>
5
//when on branch 'dev' make branch 'myFeature' off of 'dev'
git checkout -b myFeature dev
3
git switch branch_name

git checkout branch_name 
3
git checkout [branch name]
1
$ git checkout feature
2
$ git branch iss53
$ git checkout iss53
0
Rename a local and remote branch in git
Rename your local branch. If you are on the branch you want to rename: git branch -m new-name. ...
Delete the old-name remote branch and push the new-name local branch. git push origin :old-name new-name.
Reset the upstream branch for the new-name local branch. Switch to the branch and then: git push origin -u new-name.
0

New to Communities?

Join the community