Git#
Git is a popular version control software that we use to store files and track changes. It allows us to keep track of what files were changed and when, revert to earlier versions, and create branches of our code that can later be merged back together.
Branch Philosophy#
This lays out the guidelines for using branches to develop features and functionality within Polaris.
There are two protected branches
master - this is highly stable and only updated approximately once a quarter
develop - this is continually updated and is the default target for new Merge Requests
Aim for small feature branches
with < 100 commits (ideally much less)
when a feature branch is merged those commits are collapsed into a single squashed commit
When development will last longer than fits within this, then multiple feature branches will be created.
we setup a
tracking
branch to track those sub-featureswe squash merge into the tracking branch
we normal merge the tracking branch back into develop
Tracking branches can live for a long time, but they only have as many commits as their sub-branches
Feature branches should be short-lived and collapsed into their parent as quickly as possible
There is a requested feature for GitLab that would prevent squash merges into master/develop/other protected branchs but until it is implmented and deployed, everyone needs to be careful when merging. Remember:
If merging a feature into a tracking branch - SQUASH
If merging from a tracking branch to another tracking branch - MERGE
Git Introductions#
If you’d like an introduction or primer on git, these websites may help
https://docs.gitlab.com/ee/tutorials/
https://www.w3schools.com/git/git_intro.asp
https://www.freecodecamp.org/news/what-is-git-and-how-to-use-it-c341b049ae61/
Command Line Arguments#
Git is usually run through the command line, although we don’t do anything too fancy. This page is probably all you will need.
https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
GUI Options#
The easiest way to use git is via your IDE, VSCode and newer versions of Visual Studio have good built in support for VCS. If you can’t use these, there are a number of GUI options, all of which are essentially the same.
https://tortoisegit.org/
https://desktop.github.com/
https://www.sourcetreeapp.com/