1,查看全部分支:git
git branch
*号在哪代表当前分支在哪。github
2,新建一个分支:spa
git branch featureq(分支名)
转到该分支下:3d
git checkout featureq
咱们新建分支并转到那里须要两步,实际上咱们用这句一步就搞定了:code
git checkout -b feature2
3,删除分支,这里我试了下,在当前分支时候不能删除,只能在别的分支下删除他。固然还有别的状况下也不能删除,好比那个分支作了变更但没合并,这时候能够用D删除,可是慎用。blog
git branch -d feature2
4,获取指定分支上的代码,这里指的是获取分支名为branch2的代码。rem
git clone -b branch2 https://github.com/ndnmonkey/gittest1.git
“branch2 ”表明分支名字,后面跟上这个https就行。it
5,本地修改后,更新代码到gitclass
先链接git:test
git remote add origin https://github.com/ndnmonkey/gittest1.git
而后查看git branch看看你想上传到哪一个git分支中,选择并上传便可。
注意这里也可在最后一步git push origin + 分支名