1 Viewing 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.3remotes/origin/master |
2 Viewing local branches
| 12345 |
$ git branch* br-2.1.2.2master |
3 Creating a branch
| 1234567891011 |
[email protected] /f/ggg/jingwei(br-2.1.2.2) $ git branch test $ git branch * br-2.1.2.2 mastertest |
4 switching branches to test
| 1234567891011121314151617181920212223242526272829 |
[email protected] /f/ggg/jingwei (br-2.1.2.2)$ git branch* br-2.1.2.2mastertest[email protected] /f/ggg/jingwei (br-2.1.2.2)$ git checkout test M jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.javaM jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.javaSwitched to branch ‘test‘[email protected] /f/ggg/jingwei (test)$ git branch br-2.1.2.2master* test |
5 Delete local branch git branch-d xxxxx
| 12345678910111213141516171819202122232425262728293031 |
$ git checkout br-2.1.2.2M jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.javaM jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.java Switched to branch ‘br-2.1.2.2‘[email protected] /f/ggg/jingwei (br-2.1.2.2)$ git br* br-2.1.2.2mastertest[email protected] /f/ggg/jingwei (br-2.1.2.2)$ git br -d test Deleted branch test (was 17d28d9).[email protected] /f/ggg/jingwei (br-2.1.2.2)$ git br* br-2.1.2.2master |
6 view local and remote branch-a. The front with the * number represents the branch where your current working directory is located
| 12345678910111213141516171819 |
[email protected] /f/ggg/jingwei (test)$ git branch -abr-2.1.2.2master* testremotes/origin/HEAD -> origin/masterremotes/origin/br-2.1.2.1remotes/origin/br-2.1.2.2 remotes/origin/br-2.1.3remotes/origin/master |
Git most detailed address link: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 001373962845513aefd77a99f4145f0a2c7a7ca057e7570000
git view remote branch, local branch, delete local branch