Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git 的基础知识
  6. 管理 Git 历史记录
  7. 将提交复制到新分支
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

将提交复制到新分支

变基是将在一个分支上提交的所有更改复制到新分支的过程。

运行 git rebase 命令并加上-i选项以重写、替换、删除和合并历史记录中的个别提交。

您也可以使用变基命令来:

  • 重写过去的提交信息
  • 将一组提交压缩在一起
  • 添加尚未提交的文件
Diagram of reabsing.
Diagram of identifying a commit to rewrite.
确定要重写的提交并运行 git rebase -i 命令。

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life