Git:分支

详情转:https://www.jianshu.com/p/c05231e6a65a

查看分支

git branch -a
git branch -r
git branch

查看本地分支

git branch

查看分支版本流水线

git log --graph --all

查看整个版本线的状态

git log --graph --pretty=oneline --abbrev-commit

创建分支

git branch 分支名

切换分支

git checkout 分支名

创建分支并切换到该分支

git checkout -b 分支名

合并分支

  1. 快速合并
    git merge 分支名
  2. 普通合并
    git merge --no--ff -m "合并信息说明(tag)" 分支名

删除分支

git branch -d 分支名

恢复误删分支

git log --branches="被删的分支名" git branch 分支名 版本id(前七位即可)

切换分支时保存未commit的更改

  1. 储藏代码
    git stash
  2. 还原到工作空间
    git stash apply
  3. 查看储藏的所有集合
    git stash list
  4. 还原指定储藏次数的代码
    git stash apply stash@{0}

你可能感兴趣的:(Git)