Just work as a cheatsheet.
- 查看当前分支:
git branch - 查看所有分支:
git branch -a - 切换分支:
git checkout 分支名 - 新建分支:
git checkout -b 分支名 - 推送本地分支到远程分支:
git push origin 本地分支名:远程分支名 - 让本地分支与远程分支建立关联:
git branch --set-upstream-to=origin/分支名 - 删除本地分支:
git branch -d 分支名 - 删除远程分支:
git push origin:分支名 或 git push origin–delete 分支名 - 将本地未push的分叉提交历史整理成直线,使查看历史提交更容易. git rebase
- Fast-forward指的是这次合并是“快进模式”,也就是直接把master指向dev的当前提交,所以合并速度非常快。缺点是会丢失合并信息。如果禁用可以用
--no-ffgit merge --no-ff -m "merge with no-ff" dev