Please write your answers to each question in a .txt file and submit it to the "Midterm" assignment on Autolab. Some questions will ask you to download and modify a git repository. For your answer to these questions, please submit a list of the git commands you used in order.
Is git distributed or centralized? Justify your answer by briefly explaining the difference.
Give an example of a bad commit message. Do not copy the one in the notes.
Give an example of a good commit message. Do not copy the one in the notes.
Download this repository here. You will see that the repository contains a single commit that added three files, and that the working directory and staging area are clean (no changes to stage or commit). WITHOUT making a commit, use git commands (of course, you'll have to edit some of the files too) to change the git repository so that the output of git status looks like below. For your answer to this question, list the git commands you used in order.
Ilan finished question 2 of this midterm, made a commit, then modified and
staged fileB. The output of git status
now looks like this:
Give a git command for each of the following cases that will achieve Ilan's goal:
Make a directory on your computer, and initialize a new git repository INSIDE the
directory. Your task is to make commits (and the associated branches) to
this git repository so that the commit graph matches the graph below. I also
show the output of git log --graph --abbrev-commit --decorate
--all
, because after you make these commits to match the graph, you
should run this command and make sure it resembles mine. Make sure the two branches and
HEAD
end up at the correct commits.
Clone the Git repository at <ANDREW_ID>@linux.andrew.cmu.edu:/afs/andrew.cmu.edu/course/98/174/public/midtermrepo
. Notice that there are 3 branches if you print out all the branches on the remote. These all have changes I'd like to see included in one branch. To avoid conflicts between student submissions, you'll merge the branches into master on your computer, but then you'll create and push a new branch with the same name as your ANDREW ID. Merge the branches with lower numbers first.
NOTE: When merging, always include the content of the commit you are merging into master instead of master's current changes, and make sure you aren't deleting the content of any other branches you have already merged in. This might mean that you'll have to manually combine resulting merge conflicts.
HINT: Each branch has 1 modification and 1 addition. Some of these may be handled automatically and some may not be.
Things you'll be "submitting" for this question: