Nowadays I tend to use just the one device (MacBook Pro), but I still choose to use Git. Some of the benefits for me:
Saving incremental changes so I can easily revert back in case any problems arise. This also gives me more confidence to experiment within my code.
Being able to create branches also lets me experiment with new ideas without the fear of messing up my code.
Let's me use Continuous Integration that automatically runs my tests and rubocop (checks for coding style violations)
I can access my code everywhere. More than once I've fixed a wipbot bug on my iPhone! (pull code the code, make the fix, push the change)
It makes it easy to collaborate with other developers now and in the future
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.
My code is backed up in multiple places at every stage
Any merge conflicts are handled automatically when possible or are relatively easily managed manually (versus syncing app that are not optimized for code)
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.
Nowadays I tend to use just the one device (MacBook Pro), but I still choose to use Git. Some of the benefits for me:
Using Git does indeed come with the requirement of committing and pushing your code. I believe it's a habit worth developing though for the reasons above. There are also some tools you can use to make this easier. For example my Terminal is set up such that it shows when there uncommited or unpushed changes in my working repository.
Do you plan on writing code for the foreseeable future? If so, then I recommend investing in a workflow that will let you reap the rewards long-term.
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
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?
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).
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.