分支¶
| 命令 | 描述 |
|---|---|
| git branch branch-name | 分支创建 |
| git checkout branch-name | 分支切换 |
| git checkout -b branch-name | 新建并切换分支 |
| git branch -m new-name | 分支重命名 |
| git merge branch-name | 合并分支 |
| git branch -d branch-name | 删除分支 |
| git push origin --delete branch-name | 删除远端分支 |
| git branch | 查看本地分支 |
| git branch -r | 查看远程分支 |
| git branch --merged | 显示已经合并的分支 |
| git branch --no-merged | 显示未合并的分支 |
| git push -u origin branch-name | 推送 |
| git reset --hard commitid git push origin branchname --force |
回滚 |
| 命令 | 描述 |
|---|---|
| git stash | 暂存文件 |
| git stash list | 查看暂存 |
| git stash apply [stash@{1}] | 恢复到某一次 |
| git stash pop | 等价于:git stash apply + git stash drop |