Version Control
and Communication
Week 2 Curriculum
Brain of a ChainLynxer
General Overview:
Github
Github is a code hosting platform that allows teams to work collaboratively on projects (so we’re not overwriting each others’ changes and ensuring all components of our project are compatible with each other before merging them into the main branch of our repository).
*highlighted sections are all git commands
Tracking and Comparing Changes
If you want to merge the changes you’ve written for a specific feature back onto the main branch, you need to submit a pull request, which puts your code up for review to be potentially approved and integrated into main.
Choose which branch you want to compare to main, and you can view the differences between the files they share in common below.
Once you are confident in your changes, click Create Pull Request. If your changes are denied for any reason, someone will discuss how to improve your code with you before you should submit another pull request.
To view commit history (person, commit name and body, date), click:
Resolving Conflicting Changes
Sometimes you may not be able to merge your changes because they contradict an earlier change (e.g., trying to remove or edit a file that no longer exists).
Sometimes you may not be able to merge your changes because they contradict an earlier change (e.g., trying to remove or edit a file that no longer exists). To resolve these conflicts, view the repository’s history/changelog and a diff (side by side comparison of the differences between your branch and the branch you want to merge into).
Example of a commit in history
Upon clicking on the commit’s name, a diff file will appear to view what was changed by that commit (you can similarly view this upon submitting pull request, but multiple files might be available for comparison).
Branches
There are a bunch of git commands that you can execute from the command line (partial list here: https://dzone.com/articles/top-20-git-commands-with-examples) if you a personal computer, but for now we’ll just stick with Github.
Branch (feature + immediate dependencies)
Main
As stated earlier, a branch is a set of code changes over one or more files that has been isolated for individual editing and testing before merging into another workspace (ex. into and from main, but you can also have a branch of a branch of a branch, etc.). However, you shouldn’t branch every time you want to commit something to a repository, as it’s often fine to directly commit to an already existing branch.
You should only branch when you have a new feature to contribute, such as a new subsystem or convenience feature (e.g., logging system). Before creating a new branch, check to see if you can integrate your code into one that already exists, to reduce clutter in the repository.
Should you branch for…
Note that you might not have admin permissions to branch (just ask someone who does to do so for you).
Discussing Changes
Open discussion time. We need to maintain active communication to optimize our productivity. Which of the following options sounds best to you? Feel free to suggest others.
Committing Changes
With Github:
With Github Desktop:
Using the Command Line:
Summarize what change you made in a few words
(don’t use the default commit message)