Git: view remote branches, local branches, and delete local branches. git: View branch Deletion
1. view remote branches
123456789101112131415 |
$ git branch -a * br-2.1.2.2 master remotes /origin/HEAD -> origin /master remotes /origin/br-2 .1.2.1 remotes /origin/br-2 .1.2.2 remotes /origin/br-2 .1.3 remotes /origin/master |
2. View local branches
12345 |
$ git branch * br-2.1.2.2 master |
3. Create a branch
1234567891011 |
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git branch test $ git branch * br-2.1.2.2 master test |
4 switch branch to test
1234567891011121314151617181920212223242526272829 |
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git branch * br-2.1.2.2 master test shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git checkout test M jingwei-server /src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd .java M jingwei-server /src/main/java/com/taobao/jingwei/server/util/ServerUtil .java Switched to branch 'test' shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei ( test ) $ git branch br-2.1.2.2 master * test |
5. Delete the local branch git branch-d xxxxx
12345678910111213141516171819202122232425262728293031 |
$ git checkout br-2.1.2.2 M jingwei-server /src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd .java M jingwei-server /src/main/java/com/taobao/jingwei/server/util/ServerUtil .java Switched to branch 'br-2.1.2.2' shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git br * br-2.1.2.2 master test shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git br -d test Deleted branch test (was 17d28d9). shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2) $ git br * br-2.1.2.2 master |
6. View local and remote branch-. The branch with the asterisk (*) in front of the current working directory
12345678910111213141516171819 |
shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei ( test ) $ git branch -a br-2.1.2.2 master * test remotes /origin/HEAD -> origin /master remotes /origin/br-2 .1.2.1 remotes /origin/br-2 .1.2.2 remotes /origin/br-2 .1.3 remotes /origin/master |
Git most detailed address link: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001373962845513aefd77a99f4145f0a2c7a7ca057e7570000