Home CPSC 225

Assignment 2: Using Git

Objective

To practice using Git to manage version history.

You should have completed week five before attempting to complete this assignment.


Overview

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.


Details

  1. If you have not already done so, run the configuration commands described in the notes on Git.
  2. Create a directory for this assignment called "assignment2".
  3. Change into this directory, and create a new Git repository here.
  4. Create a file called "name.txt", and put your name in it.
  5. Add "name.txt" to the repository.
  6. Commit this change, and write "Add name" as the commit message.
  7. Add a file called "pi.txt", and put the text "3.14" in it.
  8. Add "pi.txt" to the repository.
  9. Commit this change, and write "Add pi" as the commit message.
  10. Delete the "name.txt" file.
  11. Restore this file with "git checkout".
  12. Edit the "pi.txt" file, and change it to read "3.1416".
  13. Commit this change, and write "Increase pi precision" as the commit message.
  14. Edit the "name.txt" file and add a line which says "This is a mistake".
  15. Commit this change, and write "Committing mistake".
  16. Now revert the change which you have just committed. Leave the commit message for the revert as the one which Git inserts automatically.
  17. Create a file called "done.txt", and put the text "Done!" in it.
  18. Add this file to the repository.
  19. Commit this change, and write "All done" as the commit message.
  20. Run "git status" and "git log" to ensure that you have a clean working directory, and that your commits are all in place.

Submitting

To submit, create a tarball of your assignment2 repository by running:

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 © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.