Lab 3—Version control
Objectives
- Create a Git repository
- Work with another person and a Git repository
- Understand the basic functionality of Git/version control software
Pre-lab work
If you are not familiar with Git, then run through the Interactive (15 Minute) Git Tutorial (https://try.github.io/levels/1/challenges/1).
If you need more info on using git, see the Git Docs. Google is also your friend.
Git
Complete the following actions:
- If you do not already have one, create a GitHub account
- Create a public git repository
- Clone the repository to your local machine
- Add and commit a simple README file with your name and the name of this assignment
- Add and commit a few other files (anything you like) to the repository
- Created a tag named
v0.0.1
- Push all changes and tags to your remote repository (note that tags require a special flag to be included in push)
- Create and checkout a new branch named
testing-new-files
- Add and commit a few more files to this branch
- Checkout the master branch
- Edit and commit at least one of the files in this branch
- Merge the
testing-new-files
branch into the master branch - Checkout the
testing-new-files
branch - Edit and commit at least one of the files in this branch
- Push all of your changes in both branches to your remote repository (make sure that both branches show up on your remote host)
- Find a partner or teammate
- Grant this person write access to your remote repository
- Clone your partner’s remote repository to a new directory outside your original repository
- Edit the README file in your partner’s master branch to list your name as ‘Partner:
' - Commit your changes
- Push your changes to your partner’s remote repository
- Return to your original repository (but do not pull from your remote branch yet)
- Checkout your
master
branch - Edit your README file to add a line that says “This might cause a merge conflict”
- Commit your changes
- Make sure your partner has completed Step 21 (e.g. pushed their changes to your README)
- Attempt to pull your partner’s changes to your repository
- Resolve the merge conflict if one occurs
- Commit the merge (assuming a conflict occurred)
- Push the merged changes back to your remote repo
Credit
To get credit for this lab exercise, show the TA and sign the lab’s completion log which includes:
- Your name – Github account name
- Your partner’s name – Github account name
- The screenshots of the merge conflict and resolution.
Lab material by Liz Boese.