Throughout your time in the co-op program (and in your future careers), you'll likely encounter a few different Version Control Systems, and various workflows that each team and company finds works for them. We use a variation of the gitflow model, which is a pretty popular pattern that you might see in the workplace.
Branches
Branches allow us to perform development in parallel, and isolate individual features. There are two main types of branches:
- master (or the integration/release branch)
- feature branches
master
We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state (or a state with the latest delivered development changes for the next release). Any code that is in the master branch has been reviewed, tested, and signed-off by at least one of the Software Leads, and we should be able to clone the repository and flash the firmware onto a board without any issues.
Note: You should never, ever commit directly to master!
Feature Branches
All development is done in feature branches, before being merged into master.
A feature branch is branched off the master branch, and development on that feature happens in parallel with master. When development is complete, a pull request is submitted, after which it is merged back into the master branch.
Sample Scenario
Alice is working on a project. She clones the repository
git clone
and then creates a new feature branch.
git branch -b your_great_feature
Because Alice is a good developer, she routinely makes commits and pushes them to the remote repository (GitHub).
git push -u origin your_great_feature
Once she feels like her code is ready for review, she opens a pull request and puts the code up for review. A Software Lead will work with her to review the code, and she'll make any changes, and add them to the review. Once this is approved, the changes can be squashed and merged.
TL;DR
- Create feature branch
- Perform development in feature branch
- Routinely push commits to remote tracking repository
- Put code up for review
- Squash and Merge into master