在Git上将一组提交合并为一个 [英] Collapsing a Group of Commits into One on Git

查看:73
本文介绍了在Git上将一组提交合并为一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有做大量小提交的习惯,我很好。但我希望不时收到一堆线性提交,并将它们合并为一个提交,并提供一个新的提交消息。



我查看了文档,但对我来说似乎有点神秘。是否有人知道如何做到这一点?解析方案

假设你想重写树的历史,直到(但不包括)commit a739b0d

  export EDITOR = vim#or your favorite editor 
git rebase a739b0d --interactive

请务必阅读交互式重新标记


I have the habit of making a huge number of small commits, and I'm fine with it. But I would like to, from time to time, take a bunch of those linear commits and collapse them together as just one commit with the ability to write a new commit message.

I've looked into the documentation but seemed a little to cryptic to me. Does anybody knows how to do that?

解决方案

Suppose you want to rewrite the history of the tree going back until (but not including) commit a739b0d.

export EDITOR=vim # or your favorite editor
git rebase a739b0d --interactive

Be sure to read up on interactive rebasing first.

这篇关于在Git上将一组提交合并为一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆