Gitflow: Should I squash commits when merging from a release branch into master?

后端 未结 3 1626
梦毁少年i
梦毁少年i 2021-02-05 01:20

I am going to merge my release branch to master and I am wondering if I should squash the commits from develop into a single merge commit when merging into master.

Gener

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 01:58

    In my opinion, and bear in mind, this is just an opinion, and you will likely get different answers, you should NOT squash the commits when merging into master from the develop branch. Doing so would lose a lot of the history of the changes that have been made. For example, almost all the commits I make are tagged with an issue number, so that there is full trace-ability back through the git history into the issues that were raised, and why changes were made.

    More to the point, you shouldn't be merging directly from develop into master. Assuming you are following git-flow, then this transition should be being done through a release branch.

    If you had asked whether, when on a feature or hotfix branch, should the commits be squashed then that would have been a different answer. In these cases, arguably the branch should be small enough to warrant only a single commit, so in these situations, I almost always rebase and squash commits into a single one, prior to merging into the target branch.

提交回复
热议问题