7

I work in a small company, where I used to be the only developer. We recently welcomed a few other people on the team, and started thinking about how to organize development efforts.

I am pretty much a novice in terms of code management, as this is my first job out of college. As part of a test, I tried working using pull requests last week (we use GitLab). It made discussing code changes related to a single feature much easier, and I'd love to continue using them.

However, we found that there were tons of little improvements that by themselves didn't look worth a pull request. Typos, small comments, very small bug fixes, sometimes completely unrelated things we just noticed as we were implementing the large features.

How are those cases generally handled?

  • Should we add "fix" commits directly on our dev branch?
  • Should we create and merge a PR with just one small fix?
  • Should we group a bunch of those commits into one big "misc fixes" PR?
  • (Added) Should we allow small commits at the beginning of each PR?
  • Any other option?
2
  • IMO this is a great question, and I am a bit saddened to see it did not get more traction.
    – Marchyello
    Commented Feb 3, 2022 at 11:10
  • @Marchyello seeing that question revisited years later is interesting in a way, right now in a different company far far away our PRs are just big bunch of all related changes, so we just bundle the quick fixes there. I concede that it's definitely not the easiest to review, but at the same time it's useless to worry about doing small commits if you're not going to be using that fact to improve development!
    – F.X.
    Commented Feb 3, 2022 at 13:25

1 Answer 1

2

I like grouping code cleanup into a single commit and then going from there. Make sure you apply the code cleanup PR before dealing with the other ones -- you'll reduce your headaches.

5
  • Thanks! Would you make a separate PR for the cleanup commit(s), or include them at the beginning of the PR you're working on?
    – F.X.
    Commented Jan 19, 2015 at 21:58
  • 2
    @F.X. In general, prefer many small commits and pull requests over large ones that do a number of different things. This makes them much easier to review, makes it easier to determine where and when (and by whom) a problem was introduced, and simplifies merging of the changes (less large conflicts!). It does make sense to group small cleanup actions into a single commit, but if it's a noticeable improvement, it should be offered to others as a PR immediately.
    – amon
    Commented Jan 19, 2015 at 22:25
  • So, looking from some clarification here from @MarkAHershberger - you're stating code cleanup as a single commit. In my book, code cleanup is not equal to bug fix - so typos and comments would be in, bug fixes would be out. Is that what you're meaning here too?
    – J Trana
    Commented Jan 20, 2015 at 4:04
  • Right, typos in comments and whitespace changes (e.g converting tabs to spaces or vice versa) are should be grouped together away from the actual bug fix. Commented Apr 4, 2015 at 22:32
  • Just noticed I never actually accepted your answer. 2 years later, this is pretty much what I ended up doing, so your advice was spot on! Thanks!
    – F.X.
    Commented Mar 3, 2017 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.