Git 命令清单
常用 Git 命令速查,分支、提交、回滚、暂存全覆盖。
广告位(百度联盟文中广告位)
| 命令 | 说明 | 示例 | |
|---|---|---|---|
| git init | 初始化 | git init | |
| git clone | 克隆 | git clone url | |
| git add . | 暂存 | git add . | |
| git commit -m | 提交 | git commit -m "msg" | |
| git status | 状态 | git status | |
| git push | 推送 | git push origin main | |
| git pull | 拉取 | git pull | |
| git branch | 分支 | git branch feat | |
| git checkout -b | 切分支 | git checkout -b feat | |
| git merge | 合并 | git merge feat | |
| git rebase | 变基 | git rebase main | |
| git log --oneline | 历史 | git log --oneline -10 | |
| git stash | 暂存改动 | git stash | |
| git reset --hard | 回退 | git reset --hard HEAD~1 | |
| git fetch | 获取 | git fetch | |
| git remote -v | 远程 | git remote -v | |
| git diff | 差异 | git diff | |
| git tag | 标签 | git tag v1.0 | |
| git cherry-pick | 摘取提交 | git cherry-pick abc123 |
广告位(百度联盟信息流广告位)