git branch operation

View remote branches

git branch -r

View local branch

git branch

View local and remote branches

git branch -a

create branch

 git branch test

switch branch

git checkout test

delete local branch

git branch -d xxxxx

Pull remote branch and create local branch

method one

Use the following command:

git checkout -b 本地分支名x origin/远程分支名x

Using this method will create a new branch x locally and automatically switch to the local branch x.

The local branch established in this way will establish a mapping relationship with the remote branch.

Method 2

Use the following command:

git fetch origin 远程分支名x:本地分支名x

Using this method will create a new branch x locally, but will not automatically switch to the local branch x, you need to manually checkout.

The local branch established by this method will not establish a mapping relationship with the remote branch.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324967147&siteId=291194637