4

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?
1

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.

  • 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. Jan 19 '15 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 Jan 19 '15 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 Jan 20 '15 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. – Mark A. Hershberger Apr 4 '15 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. Mar 3 '17 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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