Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [january-dev] Squash and Merge vs Create a Merge Commit

100% agree of the unhelpful nature of the repo history.

Personally, I don't like the "squash when accepting pull request" option. My feeling is that any squashing should be done by the pull request author, rather than the person accepting the pull request making their own guess as to what the correct level of granularity for the commits is.

If the pull request looks like all or some or it should have been squashed, that should be referred back to the author (the first time, authors may need some guidance about how to proceed).

Options like squash on accept that only need to exist because:
  1. Not all developers are aware of git squash.
  2. Not all developers are aware of git rebase.
  3. Not all developers are aware of git amend commit.
  4. Not all developers are aware that if you force push your change branch, GitHub notices that and correctly treats it as a new version of your pull request (the equivalent of a new patchset in Gerrit).
  5. And worst of all, some developers clearly never look at what they have actually pushed.
I don't expect people to become experts in git as well as everything else. However, reviews should identify when the pull request is poorly constructed, and that's a good time for a developer to learn how to clean it up.

My ideal workflow would be:
(1) Developer gets the pull request clean, which means one or more commits, where each commit is a suitable size. If a commit has an error (eg a spelling error in a comment), the original commit should be fixed up and replaced; the correction should not be a separate commit. There MUST NOT be any commit in the chain where master is merged into the pull request - that's what rebase is for.
(2) If the clean pull request is a single commit, then that can be rebased master, and then fast forward.
(3) If the clean pull request is a multiple commits, then it's a feature branch, and it can be rebased on master, and then merge (don't FF at this point, even though it is possible, but use a merge so that the series of commits for the feature is preserved).

If you don't like the command line, EGit can do all this.

FWIW!

Matthew

On 13 March 2017 at 19:09, Jonah Graham <jonah@xxxxxxxxxxxxxxxx> wrote:
Hi devs,

At the moment we are adding to the git history lots of irrelevant commits. Nearly half of the commits are merge commits that just have the effect of making our history messy looking without adding much information.



Back to the top