Git : Merge multiple commits from one branch into another

廉价感情. 提交于 2019-12-01 03:13:14

问题


I have following use case.

  1. I have a mainline branch.
  2. Created new branch(dev) from mainline.
  3. 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


回答1:


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.



来源:https://stackoverflow.com/questions/34328520/git-merge-multiple-commits-from-one-branch-into-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!