Homework 4: Checkout dat commit

This homework is due 2/22 at 6:30 p.m. You should combine all of your responses in a .zip file named ANDREWID.zip and submit it on Autolab. Your zip folder should include hw4.txt and hw4repo.

Please answer the following questions in a file called hw4.txt. Here is a template for you to use.

  1. Download and unzip the hw4repo from here.

    This repo contains 4 branches. Complete the following steps and be sure to write your written answers in the hw4.txt file and include hw4repo in your submission.
    1. Merge the day branch into master. What is this type of merge called?
    2. Switch to the friend branch. Before merging this branch into master, undo (hint: git reset) the latest commit, which accidentally corrupted the poem. After doing this, merge this branch into master. Why does this cause merge conflicts?
    3. Merge the title-and-byline branch into master. Why does this not cause merge conflicts even though it's not a fast forward merge?
  2. What's the result of typing git commit with a Git repository in the state below? What files are in the working directory and what files are in the staging area? What about files in public/javascripts?

    A git status screenshot

  3. After a long vacation in Bermuda, Charlie returns to work on his project but discovers that someone has deleted all the files in his project with rm -rf *! Fortunately, the unknown adversary didn't realize Charlie followed good software practices and was using version control with git, so they forgot to delete the .git directory and did not run any git commands.

    1. Describe in words what the output would generally look like if Charlie runs git status.
    2. Give a command or a series of commands that would restore Charlie's project from the last commit (HEAD).
  4. A git repo containing the files A, B, C, D, E, and F is in the following state:

The previous state of the git repo

List a series of git commands that would cause git status to return this instead:

The final state of the git repo