“Gitting” Good with Git
If you are a software developer, then using is a git is a tool that will save your life. As a professional VR developer working in a team environment not only has git save my butt but the whole team. As a solo developer, it can become easy to develop bad git habits. I know after spending years as a freelance web developer it is easy to commit your changes to the master branch or commit and push before pulling.
But there are two Habits that I would implore anyone reading this post that I would like you to get in the habit of these have literally saved my bacon. The first is Branch. Even when you are solo on a project, branching your repositories is good practice. I try to always have at least two branches in my repository, this means that my latest stable build is on my main/master branch and anything I am working on is in my Development branch. Once my changes are done and QA tested then you can merge back to the main/master branch.
The other habit to get into is pull, add, commit then push. Repeat after me PULL, ADD, COMMIT then PUSH. By a member of my team forgetting to pull before committing to a major project ended up causing a major merge conflict that required several hours going over the two versions and making sure all the correct code was merged.
The last pearl that I can advise is to commit often, and as the end of the day is approaching get your project in as close to a bug-free state as possible. What I mean by this if it is near the end of the day and you finish writing a new Game Component and it is Working in the editor with no errors then that is the time to do an End of Day commit. While it may not be finished but it in a working state that is all you need. While I might continue working for the next 45min to an hour on the code I may not finish those changes by the end of the day, so an EOD commit just helps me keep it in a state that is, if anything happens overnight I’ve only lost around 45mins of work.
These Commits I usually title like this EOD 20210320, if working on a team project I will also add a -Geoff at the end so my team knows that this my End of Day commit.
NB if I’m working late on my own projects if I get that state where the script is working I’ll make my EOD commit and then head to bed.