高频工作流 Pro Git · 第 5 章
git init git add . git commit -m "Initial commit" git branch -M main git remote add origin <URL> git push -u origin main
git switch main && git pull --rebase git switch -c feat/xxx # 修改代码 … git status && git add . git commit -m "feat: xxx" git push -u origin feat/xxx
git remote add upstream <原仓库URL> # 只需配置一次 git fetch upstream git switch main git rebase upstream/main git push
git rebase -i origin/main # 在编辑器里:pick 改 s(squash) 合并、reword 改说明、drop 丢弃 git push --force-with-lease
git switch -c hotfix/bug main # 修复并提交 … git switch main && git merge --no-ff hotfix/bug git tag -a v1.0.1 -m "修复登录崩溃" git push origin main --tags