Best practices for Git commits?

I’ve been updating my online portfolio hosted on GitHub, and find myself getting lazy. Instead of developing on my local server, then publishing changes, I’ve been making little changes and pushing them to the portfolio repository. Sometimes it’s as simple as adding a link, other times it’s adding/removing a feature, or a whole group of images at once.

I get the feeling there’s a better way of committing and pushing changes in general, but before I get too entangled in one method, I thought I’d ask you who are working with Git (or any versioning system, for that matter) how you do things. Any advice is welcome, especially if you have a particular reason for how you work.

3 thoughts on “Best practices for Git commits?

  1. Do whatever feels natural. When you find a good stopping point, write what you did as the commit message and commit. If you think the commit encompasses all you wanted to accomplish, then you can push it. When it is not, keep hacking away at whatever you were doing, commit as you go along, then do a rebase and combine those small commits into larger, discrete commits.

    Myself, I make lots of commits. I use commit messages to write down what I’m thinking at that point in time, and then later rebase, and gather them all up into a single commit where the entire work is complete.


    1. Thanks @sc68cal.

      I’m new to Git, so it seems I need to learn more about rebase. The idea of being able to group commits together makes sense, especially for my workflow.
      It seems that when I start working on one feature, I get ideas about tweaking other related features. I was concerned that my commits would get jumbled, but if I can go ahead and commit the first feature, work on the related one and commit it, then join them together before a push, that would be ideal.


Comments are closed.