Git squash

作者: JaedenKil | 来源:发表于2019-07-23 12:04 被阅读0次

The goal is to squash the latest 4 commits into one.

git rebase -i HEAD~4

In the vi editor:

Change

pick 01d1124 Message....
pick 6340aaa Message....
pick ebfd367 Message....
pick 30e0ccb Message....

to

p 01d1124 Message....
s 6340aaa Message....
s ebfd367 Message....
s 30e0ccb Message....

Later in the next vi editor, edit the commie messages, comment the useless commits with #, and save the needed one.

Be aware:

pick the toppest commit and squash the rest, otherwise an error will show up Cannot 'squash' without a previous commit.

相关文章

  • Git squash

    The goal is to squash the latest 4 commits into one. In t...

  • Git squash part 02

    We can use command git rebase -i to squash commits.Howeve...

  • git压缩版本快照

    目前有两种方案: git merge --squash git rebase -i HEAD~n 1. merge...

  • git

    ###merge 合并多条提交信息为一条 ``` cd到项目目录git git merge --squash an...

  • 如何git squash

    假设我有一个commit已经push到远端了,现象我想加一个新的commit,并且合二为一后,在push到远端,我...

  • git squash 用法

    在开发一个功能的时候会反复的提交代码,会造成一个功能有很多次提交,在我们要向master做分支合并的时候,就会出现...

  • Git 常用命令介绍之merge --squash的使用场景

    git merge --squash {branch} 远程仓库 project-A 中,有个公用分支dev,团队...

  • 「Git」merge –squash介绍

    Git相对于CVS和SVN的一大好处就是merge非常方便,只要指出branch的名字就好了,如: 但是,操作方便...

  • git commit合并

    git rebase -i 合并之前的那个commit pick表示执行squash表示被合并 pick命令保留要...

  • Git合并本地更改(Squash)

    很多时候,把本地多个Git commit合并为一个再push,有很大的优势。这个操作在Git中被称为Squash。...

网友评论

    本文标题:Git squash

    本文链接:https://www.haomeiwen.com/subject/fpjolctx.html