Gerrit: combine multiple commits into one “change”

前端 未结 3 452
温柔的废话
温柔的废话 2021-01-30 13:30

As a git best practice, one should commit frequently, but to review the code you may need to review a patch consisting of multiple commits at once. Is there a way multiple comm

3条回答
  •  野的像风
    2021-01-30 13:42

    One thing you can do a squash merge to a temporary branch and then post that change for review.

    git checkout -b feature
    git commit -m "start feature"
    ...
    git commit -m "finish feature"
    git checkout -b feature-review master
    git merge --squash feature
    git commit
    

    Now your feature-review branch will contain the same diff relative to master as feature did but with only a single commit.

提交回复
热议问题