1.查看项目的分支(包括远程分支和本地分支)
git branch -a
2.查看本地分支
git branch
3.删除本地分支
git branch -d <BranchName>
*<BranchName>本地分支的名字
4.删除远程分支
git push origin --delete <BranchName>
*<BranchName>远程分支的名字
5.创建本地分支,并切换到新创建的分支下
git checkout -b <BranchName> <origin BranchName>
*<BranchName> 本地分支的名字 <origin BranchName>远程分支的名字
6.切换本地分支
git checkout <BranchName>
*<BranchName>本地分支的名字
7.推送本地分支local_branch到远程分支 remote_branch并建立关联关系
a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch
git push
b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch
git push -u origin/remote_branch
c.远程没有有remote_branch分支并,本地已经切换到local_branch
git push origin local_branch:remote_branch
8.本地分支的文件添加到远程分支
git push --set origin remote_branch
适用于本地建立分支,远程没有分支,就是第七条的c的情况。第一次提交文件,需要这么做。
mac下git log退出方法:英文状态下按Q。