Git 常用命令
基础
| 命令 | Windows | Mac |
|---|---|---|
| 查看状态 | git status | git status |
| 暂存改动 | git add . | git add . |
| 提交改动 | git commit -m "msg" | git commit -m "msg" |
| 历史图 | git log --oneline --graph --decorate --all | git log --oneline --graph --decorate --all |
分支与合并
| 命令 | Windows | Mac |
|---|---|---|
| 创建并切换分支 | git checkout -b feature/x | git checkout -b feature/x |
| 切换至主分支 | git switch main | git switch main |
| 合并主分支 | git merge main | git merge main |
| 变基 | git rebase main | git rebase main |