Single comment thread
See full discussion

Excellent answer, thanks Marc. I only started using Git about 18 months ago and though its now an established part of my workflow I'm definitely not using it to its full potential at all. I largely use it for 'i finished, push to production' and only when i remember to for 'heres a good place to save my work'.
It's probably time I worked my way through a course to make better use of branches etc. And probably time I wrote some tests too! :D

The commits are a way to document your code. So if in a year time you're wondering why you made a certain change, you can quickly find it.

I thought this was a really interesting bullet. Does this mean you try to include the 'why' in your commit messages rather than just 'fixed xyz / added abc' type notes?

It's probably time I worked my way through a course to make better use of branches etc. And probably time I wrote some tests too! :D

Haha yeah, but take it one step at a time. I feel like I haven't even scratched the surface of Git myself. But whenever I encounter a problem or notice I keep doing the same thing over and over again, I look for ways to improve my workflow. It seems like you just hit one of those issues yourself (hence the question).

Does this mean you try to include the 'why' in your commit messages rather than just 'fixed xyz / added abc' type notes?

Only if I feel like it's needed. I have plenty of "fix foo", and "add bar" type of messages though. It really depends on the circumstances. But just having every incremental change accessible separately by itself is already very valuable. For example you can go to a specific line of code and see all previous commits that touched it. So if you wonder why a piece of code is the way it is, you can just look up those commits which will help you jog your memory.

Home
Search
Messages
Notifications
More