git分支

git中一个仓库可以有多个分支,分支之间相互独立,而且又可以合并。

  • 任务需要分模块完成可以使用分支管理
  • 本地仓库push到远程仓库,但本地仓库只是远程仓库的一部分,远程仓库可以创建2个分支,一个主分支master,一个子分支other,本地仓库可以push到other,other再与主分支master合并。这样本地仓库就不需要保存master分支的全部内容。
  • 分支还能用来管理项目,切换不同的分支对应不同的子项目

常用命令

git branch <branch_name>	#创建分支
git co <branch_name>	#切换分支

git checkout --orphan=<branch_name>	//创建空分支

git rm -rf	//清空分支

git branch -d <branch_name>	#删除分支 -D强制
git push origin --delete <branch_name>	#删除远程分支
原文地址:https://www.cnblogs.com/friedCoder/p/12237940.html