Using branches in
git will be extremely helpful for both homework and projects in this class. It will also come in handy outside of class; branching is used heavily in any major software development project.
git tracks history is using a directed acyclic graph (DAG), which is a graph with arrows but no cycles (similar to a tree). You can think of branching as a label or pointer to a specific branch (or path) in this graph.
Still confused? Essentially, branching creates a new line of development that allows you to work on new features without disturbing other branches (like the
master or other stable production branches). That branch can then be merged back into other branches when that new feature is stable.
There are several guides (linked below) that explain this concept further.
All grading and code reviews will be done from your
master branch. Use a branch any time you want to work ahead or try something out without affecting how your code will be graded. This includes:
Create a branch before working on homework after the deadline. This prevents the timestamp on the
masterbranch from changing, which will trigger a late submission penalty. If you manage to get new tests passing in that branch, then it may be worthwhile to merge those changes back into
mastereven if it does trigger the late penalty.
Create a branch before working ahead on projects. You may not include code in your
masterbranch from future projects until you have fully passed code review. You are still able to make releases from other branches, so this allows you to still work ahead and pass functionality without disturbing the code review process.
In general, it is a good idea to always use branches for development and keep only stable, tested, production-ready code in the
Learning both the command-line and the Eclipse interface is recommended. Learning the commands to branch and merge helps with understanding, and learning to perform those commands within the Eclipse interface helps avoid the amount of switching in/out of the application necessary during a normal workflow.
Here are a few guides on the topic,
About Branches (Github Help Article)
Learn Git Branching (Github Interactive Training)
Using Branches (Bitbucket Tutorial)
Branching (Eclipse EGit User Guide)
Pro Git: Git Branching (E-Book Chapter)
Once you start branching, it is likely you will run into merge conflicts.
About Merge Conflicts (Github Help Article)
Managing Merge Conflicts (Github Training)
Merge Conflicts (Bitbucket Tutorial)
Merging (Eclipse EGit User Guide)
Do not get discouraged! Dealing with a merge conflict (or other repository issue) is like a rite-of-passage for software developers. It is frustrating for everyone! (There are many jokes and comics on this topic that are not necessarily appropriate to share in a classroom setting.)