5

How do you usually divide the commits?

I'm a student and I would like to know your coding preferences at both work and your personal projects. Do you prefer to commit almost fully coded classes or you just rapid-fire all the functions you finished?

Comments
  • 3
    It doesn't matter.

    You shouldn't ever be commiting non-working code to your master branch.

    You make a branch for whatever feature your developing and commit whatever you want into there, whatever your preference/workstyle works with you.

    Then merge that into master with a squash commit so you dont merge your broken commits in, only the commit that works. Then delete that branch.
  • 2
    Commit is not an issue. Just commit as much as you can. The more commits the better chance to revisit.

    Important thing is what @D--M mentioned.
  • 1
    I'm sending this exact message to my beloved classmates who commit non-working functions cause they didn't know how to do it but their job was to code and commit that :D
    @D--M
  • 2
    Only commit changes that semantically belong together. Never ever commit things that do not belong together. You will regret it.

    Official branches (incl. master/trunk) should only contain finished, working, tested code.

    On your private branches you can commit whatever you want, either finished or unfinished, containing errors, missing features, whatever, as long as you stick to the above rule. If you do so, you can clean up from your VCS at every point before merging something anywhere else and everything is fine.
    If not, you will end up merging manually, commiting it again, make mistakes, deliver buggy software, receive phone calls from QA/customer/CEO/CTO, fix your mistakes, introduce new errors, get mad, get depressed, quit your job, lose your apartement, leave your partner, and at the end the earth explodes.
  • 0
    This is getting quite helpful. Cause I've encounter some of those problems before that I could fix just by creating branches and grouping the commits properly. I'm taking this advices for sure. @ddephor
  • 2
    @Kaskagues might wanna dig this rant. I wanted to mention your name directly but cannot remember it 😁

    https://devrant.com/rants/989536/...
  • 1
    That will take me a while (maybe a year to learn). But now that I see the real depth of working on a cloud repository with multiple people commiting, keeping it clean seems like a must.
    You never end learning about programming @CurseMeSlowly
Add Comment