分支基本操作
git是一个提交组成的图,而每个分支就是一个指针,还有一个head指针。
# 查看所有本地分支
$ git branch -v
* dev2.0 0c1e617 组件名
master 0c1e617 组件名
$ git branch
* dev2.0
master
# 查看所有本地仓库和远程仓库的分支
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/haha_20191001
# 创建本地分支
$ git branch dev3.0
# 删除本地分支
$ git branch -d dev3.0
Deleted branch dev3.0 (was 0c1e617).
# 创建并检出本地分支
$ git checkout -b dev3.0
Switched to a new branch 'dev3.0'
# 检出本地分支
$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
git处于游离态
$ git branch -v
* (HEAD detached at 33954d0) 33954d0 测试本地删除2
master 0c1e617 组件名
haha_20191001 33954d0 [ahead 3] 测试本地删除2
bugs
1@DESKTOP-3H9092J MINGW64 /e/00/project_01
$ git branch
fatal: not a git repository (or any of the parent directories): .git