跳转至

Git 速查表(Cheat Sheet)

常用

git status
git add .
git commit -m "msg"
git log --oneline --graph --decorate --all
git diff / git diff --staged

分支

git branch -a
git switch -c feature/x
git merge feature/x
git rebase main

远程

git remote -v
git push -u origin main
git pull --rebase
git fetch --all --prune

撤销

git reset --soft/mixed/hard HEAD~1
git revert <commit>
git restore [--staged] <file>
git reflog

标签

git tag -a v1.0 -m "release"
git push origin --tags