Git merge testing branch (final commit) to master branch

后端 未结 3 1408
遇见更好的自我
遇见更好的自我 2020-12-15 13:39

I have created a testing branch. It has a lot of tiny commits to build one feature. At the end of it, I want to take the final completed changes, and put them into the maste

3条回答
  •  天命终不由人
    2020-12-15 13:54

    You are looking for --squash option of git merge:

    --squash --no-squash

    Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit or move the HEAD, nor record $GIT_DIR/MERGE_HEAD to cause the next git commit command to create a merge commit. This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).

    With --no-squash perform the merge and commit the result. This option can be used to override --squash.

    So git merge --squash test-branch and commit away.

    You may also try git merge --no-commit --no-ff test-branch

提交回复
热议问题