$29
Objective
In this lab, you will explore the version control system called Git.
Working alone or in a group of 2, you will apply your knowledge of version control, notably Git, to manage a set of les for a project.
You will be given an initial con guration of Git for a project and will be asked to e ect a set of changes to the les, stored in Git, to achieve a target con guration for your Git repository.
Preparation
Download and install Git. You may use your IDE if it supports git integration, or through the command line (on windows, you may want to install Git Bash alongside Git for this).
Resources
There are many Git tutorials online that can help you. Some examples are
https://git-scm.com/docs
https://con uence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html https://education.github.com/git-cheat-sheet-education.pdf
Procedure
Set-up
1. Download and unzip the Git repository from Brightspace.
Lab steps
Part 1 - History Using git status, git log, git diff, and git branch answer the following questions:
1. How many commits are there?
2. What is the commit message associated with the most recent commit?
3. Which commit added the basePrices static variable?
1
4. How many branches are there?
5. Which is the last commit on the coupons branch? Resources: status, diff, log, branch
Part 2 - Basic operations
1. Fix the 3 remaining bugs from the Debugging lab. In particular:
On lines 62, 64, and 66, topping == str should be topping.equals(str)
On lines 63, 65, and 67, price = should be price +=
The nal price should be price = price - price*coupon/100
2. Commit these bug xes with a suitable commit message
Resources: add, commit
Part 3 - Branching
1. Create a new branch called burger. Your new branch should be o the repository’s master branch
2. Add a new menu option for a burger. A burger at HfxDonairExpress costs $2.50
3. Commit this change on the burger branch
4. Finally, merge the burger branch into the main branch
Resources: branch, checkout, add, commit, merge
Questions
1. When working alone on a project, how frequently should you commit your code to a version control system? Explain why.
2. When working in a team, how frequently should you commit your code to a version control system? Explain why.
3. Why might you create branches for your project in your version control system?
Reporting
1. In one le, list
The members of your team.
The answers to the questions in part 1.
The nal output of git log after parts 2 and 3 have been completed. The answers to the Questions section of the lab
2. Generate a PDF from the document.
2
3. Create a .zip le of the git repository.
4. Submit the PDF and the zipped repository in Brightspace in the Lab/Lab 5 section.
Assessment
The assessment will be on a letter grade and will re ect how well you have used the version control system as well as how your answers to the broadening questions demonstrate that you have thought through how version control can help you in your software development.
3