建立分支git
git branch test: 基于当前commit建立test分支。.git/HEAD 文件中记录了当前分支名字。
删除分支服务器
git branch -d test:删除本地test分支 git branch -D test: test分支尚未合入当前分支,因此要用-D参数才能删掉。 git push origin --delete test 删除远程test分支 git push origin :test 删除远程test分支
查看分支fetch
git branch 列出当前分支清单 git branch -a 查看远程分支和本地分支 git branch -v 查看各个分支最后一个提交信息 git branch --merged 查看哪些分支已经合并入当前分支
拉取分支 spa
git fetch origin 同步远程服务器的数据到本地 git checkout -b test origin/test_remote 将远程分支test_remote拉取下来到本地test分支 git checkout test 将远程分支test拉取下来到本地test分支 git pull test从远程分支test 中checkout下来的本地分支test成为跟踪分支,使用git pull或者git push就会操做到对应的远程分支test