Git "squash and merge"

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Jan 18 09:15:54 PST 2017


On Wednesday, 18 January 2017 at 09:55:58 UTC, kinke wrote:
> I've seen you using it, and I liked it especially for 
> cherry-picking onto a release branch, as the automatic 
> reference to the PR (`... (#<number>)` in commit title) makes 
> it show up in the PR directly.

That's a very good argument.

> On Tuesday, 17 January 2017 at 21:44:53 UTC, Johan Engelen 
> wrote:
>> So generally, when there is no squashing to be done, I do a 
>> merge like before. Otherwise a squash+merge.
>
> Similar here, but I like it especially for single-commit PRs, 
> as having two commits for each of those doesn't make a lot of 
> sense to me.

OK, so I'm going to try to do this from now:

if (commitCount < 2) {
     squashAndMerge();
} else {
     if (niceToPreserveIndividualCommits()) {
         while (tooManyFixupCommits()) {
              askForManualCommitHistoryCleanup();
              yield();
         }
         merge();
     } else {
          squashAndMerge();
      }
}



More information about the digitalmars-d-ldc mailing list