Question 7: Git [10]

Suppose you are given the task of modifying the source code files for the project from question 6, but first you need to put the project under version control.

You must initialize a git repository for the project (in the same directory as the makefile), add all the project source code files and the makefile to the project repository, and perform an initial commit.

Once the repository is set up and the initial commit done, you will need to create a new branch, guiAdd, before starting to make changes.

(i) Provide the sequence of git commands you will need to use to get to this point.

(ii) The changes you will need to make involve adding a graphical user interface, the code for which will be in two new files: gui.cpp and gui.h, and of course changes will need to be made to the makefile. Assuming you have completed your first set of edits to those three files, provide the git commands you will need to bring the repository up to date.

(iii) Assuming the changes worked out perfectly but other changes have also been made to the master branch, provide the git commands necessary to merge the master's changes into the guiAdd branch.

(iv) Suppose the changes in the master branch also involved changes to the makefile, what would happen when you attempted the merge and how would you fix it?