Git Rebase:重写提交历史
git checkout feature
git rebase main
交互式Rebase
git rebase -i HEAD~3
# pick = 保留 | squash = 合并 | drop = 删除
Git Cherry-pick:精准摘取提交
git checkout main
git cherry-pick <commit-hash>
git cherry-pick <hash1> <hash3> <hash5>
Git Stash:临时保存工作
git stash push -m "正在开发登录功能"
git stash pop
git stash list
Git Bisect:二分法查找Bug
git bisect start
git bisect bad HEAD
git bisect good v1.0.0
git bisect reset
其他实用技巧
git reflog
git reset --hard <commit-hash>
git worktree add ../hotfix-dir hotfix-branch
git log -S "functionName" --all
提交信息规范
feat(auth): 添加JWT令牌刷新功能
fix(api): 修复用户查询接口超时问题
记住:不要对已推送的公共分支执行rebase!
📢 本文为精简版,完整版包含独家工具推荐和深度分析,请访问 WD Tech Blog 查看!
关注我的博客获取最新科技资讯、AI教程和效率工具推荐!
Top comments (0)