Git 进阶技巧和工作流
介绍 Git 基础知识很重要,但掌握进阶技巧能让你的开发工作流更高效。本文介绍一些实用的 Git 进阶技巧。 分支管理 创建和切换分支 # 创建新分支 git branch feature/new-feature # 切换分支 git checkout feature/new-feature # 创建并切换分支(简写) git checkout -b feature/new-feature # 或使用新语法 git switch -c feature/new-feature 删除分支 # 删除本地分支 git branch -d feature/new-feature # 强制删除分支 git branch -D feature/new-feature # 删除远程分支 git push origin --delete feature/new-feature 分支重命名 # 重命名当前分支 git branch -m new-name # 重命名其他分支 git branch -m old-name new-name # 推送重命名后的分支 git push origin new-name git push origin --delete old-name 变基(Rebase) 变基是一种整理提交历史的强大工具。 ...