Rename local branch and remote branch
-
Switch to the local branch to be renamed
1
git checkout <old-name>
-
Rename local branch
1
git branch -m <new-name> -
Push
<new-name>branch to remote repository1
git push origin <new-name>
-
Delete
<old-name>branch in remote repository1
git push origin --delete <old-name>
View the relationship between local branch and remote branch
1
git branch -vv
Create connection between local branch and remote branch
Checkout to the target local branch.
1
git push -u origin <remote-br>
or
1
git branch --set-upstream-to=origin/<remote-br> <local-br>
After this operation, you can run git push and git pull in the branch and it will automatically communicate with origin/<remote-br>.