- 查看分支
1
git branch
- 创建分支
1
git branch <branch-name>
- 切换分支
1
git checkout <branch-name>
- 创建 + 切换分支
1
git checkout -b <branch-name>
- 合并某分支到 当前分支上
1
2
3
4// fast forward 合并模式
git merge <branch-name>
// 普通合并模式
git merge --no-ff -m 'some comments' dev - 删除分支
1
2
3git branch -d <branch-name>
// 强行删除一个没有被合并过的分支
git branch -D <branch-name> - 查看合并分支情况
1
git log --graph --pretty=oneline --abbrev-commit
- stash
1
2
3
4
5
6
7
8
9
10// 当前工作副本临时保存
git stash
// 所有 stash 的工作副本
git stash list
// 恢复工作副本(并不删除)
git stash apply stash@{0}
// 删除工作副本
git stash grop stash@{0}
// 恢复最近一次的工作副本, 并且删除该副本
git stash pop - 与远程服务器
1 | // 查看远程服务器信息 |