Can I squash commits in Mercurial?

后端 未结 8 1708
时光说笑
时光说笑 2020-11-30 20:13

I have a pair of commits that should really be just one. If I was using git, I would use:

git rebase -i 

and then

相关标签:
8条回答
  • 2020-11-30 20:54

    The Rebase extension worked like a charm. To squash 2 commits:

    $ hg rebase --dest .~2 --base . --collapse
    

    Dot is a shortcut for current revision.

    It's even easier when you have a few commits on a branch and want to collapse them all into one:

    $ hg rebase --dest {destination branch (e.g. master)} --base . --collapse
    

    How this works:

    enter image description here

    (from http://mercurial-scm.org/wiki/RebaseExtension#Collapsing)

    0 讨论(0)
  • 2020-11-30 20:56

    I use:

    hg phase --draft --force -r 267
    ...
    hg rebase --dest 282 --source 267 --collapse
    
    0 讨论(0)
提交回复
热议问题