Assignment 2: Using Git
To practice using Git to manage version history.
You should have completed week five before attempting to complete this
This assignment requires you to have completed weeks one through five of
the course. You will follow the instructions below to create a Git repository,
add files and commit them, using the tools you learned thus far.
- If you have not already done so, run the configuration commands described in the
notes on Git.
- Create a directory for this assignment called "assignment2".
- Change into this directory, and create a new Git repository here.
- Create a file called "name.txt", and put your name in it.
- Add "name.txt" to the repository.
- Commit this change, and write "Add name" as the commit message.
- Add a file called "pi.txt", and put the text "3.14" in it.
- Add "pi.txt" to the repository.
- Commit this change, and write "Add pi" as the commit message.
- Delete the "name.txt" file.
- Restore this file with "git checkout".
- Edit the "pi.txt" file, and change it to read "3.1416".
- Commit this change, and write "Increase pi precision" as the commit message.
- Edit the "name.txt" file and add a line which says "This is a mistake".
- Commit this change, and write "Committing mistake".
- Now revert the change which you have just committed. Leave the commit message for the revert as the one which Git inserts automatically.
- Create a file called "done.txt", and put the text "Done!" in it.
- Add this file to the repository.
- Commit this change, and write "All done" as the commit message.
- Run "git status" and "git log" to ensure that you have a clean
working directory, and that your commits are all in place.
To submit, create a tarball of your assignment2 repository. To do this,
first make sure you are in the directory where the assignment2 directory is
(but not inside assignment2. Then run:
tar -czvf assignment2.tar.gz assignment2/
Then turn in the tarball by running:
./submit username 2 assignment2.tar.gz
Where username is your UMW netid.
This will transfer your submission to the server where it will be graded.
It will print your grade to the screen and record your grade. You can submit
the assignment as many times as you like. Your best grade will be used.
Copyright © 2019 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.