Use Version Control

Overview

Teaching: 5 min
Exercises: 15 min
Questions
  • How should I manage work using version control?

Objectives
  • Explain how to use feature branches to manage software development.

Version Control

How Do You Manage Your Repository?

Describe in 3-4 bullet points how you actually manage your version control repository. How often are you working on several things simultaneously?

Github Flow In Action

  • Before the workshop, make a copy of the SNDS repository by cloning it to your local system and pushing it to a new empty repo on Github (something like https://github.com/YourUsername/snds-demo-yyyy-mm-dd). Make sure to collect Github usernames from all participants pre-workshop so you can give them write access to the repo.
  • The first pull request will be simple to merge. This will give an opportunity for a brief demo of the code review functionality, comment on particular lines, comment threads, etc.
  • The second pull request will likely have a merge conflict. This is now super simple to handle in Github’s web interface, and can also be covered in a very brief demo.
  1. Clone the SNDS repo to your laptop
  2. Create a new branch with a unique label (such as your last name) and check out that branch.
  3. Add your name and email address to the CONTRIBUTORS file.
  4. Commit your changes, push your new branch to Github, and open a new pull request to merge your “feature branch” into master.

Key Points

  • Use version control for everything created manually, not just code.

  • Create a new branch for each feature.

  • Only use that branch for that feature.

  • Merge and delete the branch when the feature is complete.