Homework 3: Branching away from the master source

This homework is due 2/8 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 q1.txt, q2.txt or q2.jpg, and hw3repo.

  1. Answer the following questions in a file called q1.txt, then submit the file:

    1. What is a fast-forward merge, and what conditions are necessary to induce one? Explain briefly.

    2. Write a series of git commands that would produce the following git graph. You may omit edit and git add commands for brevity. Make sure that branches and HEAD end up on the right commits by the end. (Hint: Start with git commit -m "A")

  2. Assuming you begin on the master branch without having made any commits, draw the git commit graph resulting from the following commands. Edit and git add commands have been omitted for brevity. Make sure to label where each branch ends up in the final state, and where HEAD is. You may submit a text diagram as q2.txt or an image/scan of a hand drawing.

    1. git commit -m "A"
    2. git checkout -b vNext
    3. git checkout master
    4. git commit -m "B"
    5. git branch experiment
    6. git commit -m "D"
    7. git checkout vNext
    8. git commit -m "E"
    9. git merge master
    10. git checkout experiment
    11. git commit -m "C"
  3. Download this hw3repo zip file and extract it. Open a terminal in the hw3repo folder. You will see a master and develop branch. Carefully examine program.c on each branch (each has its own function). Merge the develop branch into the master branch. You will encounter a merge conflict. Fix the merge conflict by fixing the file to keep both functions (this is why I had you read both first! It's very easy to make a mistake here!). Finish the merge commit.