Programming Tutorials

Git and GitHub

Git is a version-control system for tracking changes in code. GitHub is an open-source software which hosts Git repositories. Together, we use them to organize and allow greater collaboration between programming members.


Imagine you are editing your code with a few buddies. You make one change that you think is pretty good, but at the last minute, somebody else uploads their code and it overwrites the code you are writing. To fix this you upload your code, but that overrides everything they did. The solution Git provides is known as branching. You can think of branching much like a tree, where there is one main stream of code (The actual tree) but has small branches (changes) that are independent of the main tree and other branches. The benefit of branching is that by giving each problem its own branch, it can be worked on with its own code. Others can still view and work on your code if they wish, but they do not have to worry about their own problems affecting your branch when they are working on a separate one. Every time you edit something, you should push and commit the changes at the end.

Every repository has a master branch. The master branch is the final version of the code that you should use at a competition. "Pull requests" should happen whenever you want to push to the master branch. You should only push to the master branch when your code is completed and has no issues.

Utilizing Issues

Issues are a great way to organize what your team needs to be done right within GitHub. They are a collaboration feature which similar to Trello boards and other board based project organizers. You can mark an issue as needing to be done, such as drive train, and then add labels about what it is, anything you want. Our team uses several forms of labels, such as "autonomous" and "Teleop." You can also make a checklist of smaller tasks that make up the big task. You can set a deadline, which is really useful for seeing how far along each person is and if they are falling behind. With all these factors, issues are one of GitHub's many features that can help your team.

Special Features

GitHub has many features in addition to issues, branches, and repositories. One of these is a wiki, where you can write about a particular repositories function, about your team, or whatever you want! There are also projects, which can allow you to keep track of your work. A security tab, which is a beta feature that can allow you to talk about security problems in your code, however, this isn't something that most FTC teams need. There are many other features of GitHub, but these are the main ones. Your team can decide which features you want to use, and there are many more ways to utilize it. Have fun exploring GitHub!