Table of Contents
View the video explainer for this lab on youtube
Lab 0_5: Git Deep Dive #
The goal of this lab is to get you more comfortable with using more advanced features of git
, such as branching, resolving conflicts, and forking.
Instructions #
-
Create a repository on github titled
<github_username>-lab0.5
(replace<github_username>
). Make sure it is private) -
Add the grader as a collaborator
-
Clone the repo onto your computer
-
On the master branch, create a file called
HelloWorld.java
(just like we did in lab 0). Write a program to print “Hello World” -
add
,commit
, andpush
to the master branch -
Create a new branch using terminal commands (you can name the branch whatever you would like)
-
On the new branch, change the print message in
HelloWorld.java
(to whatever you would like, but it must be unique) -
add
,commit
, andpush
to the new branch -
Return to the master branch
-
Change the print statement (again) in the
HelloWorld.java
file (to something unique), this time on the master branch -
add
,commit
, andpush
to the master branch -
Merge the code from your new branch to the master
-
Take a screenshot of the merge conflict you receive. You can take a picture of terminal, which indicates that there is a merge conflict; You can take a picture of the
HelloWorld.java
file, which contains markings to indicate that there is a merge conflict; You can take a picture of both. -
Resolve the merge conflict
-
commit
andpush
to Github on master -
push
the screenshot of the merge conflict to Github
Troubleshooting #
Problem: git is asking me do set something called upstream?
The first time you push to a branch, git may ask you to set the upstream to a specific remote server; you can just follow the instructions it prints to the terminal to set the upstream to the correct remote branch.
Problem: I forgot to push to master before making a new branch!
It happens! Just make another branch, and push to it. You should end up, eventually, with two branches; that’s all that matters for this lab.
Grading Rubric #
Item | Points |
the name of the repo for this lab matches the pattern gitusername-lab0.5 |
10 |
the grader has been added as a collaborator to the repo | 10 |
the repo has been made private | 10 |
there are (at least) two branches | 10 |
there are (at least) three commits in master (should be the case if instructions are followed correctly) | 10 |
there is (at least) one unique commit in the new branch | 10 |
the first commit of HelloWorld.java in master differs from HelloWorld.java in the new branch |
10 |
there are no remnants of a merge conflict in the final commit to master | 10 |
screenshot proves that you did (at one point) have a merge conflict | 20 |
TOTAL | 100 |