Git : Merge multiple commits from one branch into another

I have following use case.

  • I have a mainline branch.
  • Created new branch(dev) from mainline .
  • Did multiple commits(around 20) into dev branch and pushed into dev (remote) branch as well.
  • Now I want to merge all these 20 commits into single commit and move this to mainline . How exactly I can do this?

    Thanks in Advance,
    Shantanu


    That sounds like a git merge --squash

    git checkout mainline
    git merge --squash dev
    git commit
    

    Note that, as commented here, it is best to merge mainline in dev first and solve any conflict there, before merging back dev in mainline .

    链接地址: http://www.djcxy.com/p/26086.html

    上一篇: 压缩默认的合并?

    下一篇: Git:将多个提交从一个分支合并到另一个分支