Git鼓励大量使用分支:
查看分支:git branch
创建分支:git branch <name>
切换分支:git checkout <name>
创建+切换分支:git checkout -b <name>
合并某分支到当前分支:git merge <name>
合并某个提交到当前分支 git cherry-pick <commitID>
删除分支:git branch -d <name>
git restore --staged [file] : 表示从暂存区将文件的状态修改成 unstage 状态。当然,也可以不指定确切的文件 ,例如:
git restore --staged *.java 表示将所有暂存区的java文件恢复状态
git restore --staged . 表示将当前目录所有暂存区文件恢复状态
--staged 参数就是表示仅仅恢复暂存区的
永久性分支
master branch:主分支
develop branch:开发分支
临时性分支
feature branch:功能分支
release branch:预发布分支
hotfix branch:bug修复分支
创建空白分支
git checkout --orphan 分支名
git checkout -- file 可以丢弃工作区的修改