1. View Remote Branch
Git branch-r
Origin/master
2. View local Branch
*master
Note : The local branch where the current is located is indicated by *
3. View local and remote branches
Git branch-a
*master
Remotes/origin/master
4. Create a branch
4-1 Creating a local branch
-a* master test_1 remotes/origin/master
Note : When you create a local branch, the default is to copy something from your local branch to the newly created local branch.
4-2 push local branch to remote as remote branch
$ GIT push origin test_1to [email protected]****** * [New branch] test_1-a* mast Er test_1 remotes/origin/Master remotes/origin/test_1
Note : Git push Origin test_1 will push the local test_1 branch to the far end, the local test_1 branch and the remote counterpart are test_1-->test_1
If there is no local branch test_9, the push will prompt the error
5. Switch to the branch
' test_1 '
6. Delete local Branch
$ git branch-a master test_1 test_2 remotes/origin/Master remotes/origin/ test_1 remotes/origin/--a master test_1 remotes/ origin/Master remotes/origin/test_1 remotes/origin/test_2
You can see that the local branch test_2 deleted
7. Delete Remote Branch
$ git branch-a* master test_1 remotes/origin/Master remotes/origin/ Test_1 remotes/origin/test_2$ git push origin:test_2to [email protected]*********- [ Deleted] test_2-a* master test_1 remotes/origin/ Master Remotes/origin/test_1
Note : Git push Origin:* * * is to delete the remote branch meaning, and just i delete the local unrelated. As below, I keep the local test_1 branch, just delete the remote branch test_1
$ git push origin:test_1to [email protected]********- [deleted] -a* master Test_1 remotes/origin/master
Git view, create, delete local, remote branch