Git task

Git task 2.75p

Steps which have SS means ‘save state’, which is followed by a message between quotation marks – this message must be given as a parameter to Git.

Note: Don’t copy the message with quotation marks – type them out on your own, otherwise command fails.

Note 2: ‘save state’ should be achieved by 2 git commands.

  1. Step (0.25p)
    1. Initialize Git username and email
    2. Create SSH key
    3. Display SSH key
    4. Copy and upload SSH key [ Link ]
      1. Make sure that the key does not end with a space or empty line!
    5. Clone your iax0583 repository using ssh
  2. Step (0.25p)
    1. Navigate to iax0583 directory
    2. Show working directory
    3. Create directory named lab3
    4. Display directory contents with command ls
    5. Create empty document named filmid.txt in directory lab3
    6. SS “Add filmid.txt”
  3. Step
    1. Add 10 freely chosen movie titles to the list
    2. Display the contents of filmid.txt
      1. Use text editor or alternative tools
    3. SS “Add 10 random movies”
  4. Step (0.25p + 0.25p)
    1. Display contents of the directory (list view and all files – including hidden files)
      1. Find parameters using manual [ Link for Windows users ]
    2. Create a file named kaustad.txt, in directory lab3, which has the content of previous listing
      1. Use stream redirection!
    3. SS “Add kaustad.txt”
  5. Step
    1. Add 1 movie title to random line in file filmid.txt
    2. Modify 1 row in file filmid.txt – Must be different row than previous step!
    3. SS “Modify filmid.txt”
  6. Step optional (0.5p) [ Link ]
    1. Restore the state at the end of step 4
      1. Find Git commit ID
      2. Restore the state by commit ID
    2. SS “Revert ‘Modify filmid.txt”
      1. You are prompted a commit message
        1. press ctrl+wenterctrl+x if prompt was with nano
        2. press esc, kirjuta :wq to save and exit vim
  7. Step (0.25p + 0.25p)
    1. Remove 2 random movies from filmid.txt
    2. Modify 1 movie name
    3. Display status of Git working directory
    4. Bonus – Display on the screen filtered movies (searched movie must exist in the file) using the pipe operand | .
    5. SS “Modify filmid.txt”
  8. Step (0.25p + 0.25)
    1. Display ‘Saved states’ list
      1. Boonus – 2 additional parameters to the command for formatting
  9. Step optional (0.25p)
    1. Compare the differences between 2. and 7. step
      1. Find commit ID
      2. Compare differences with command git diff
        1. Commit messages “Add filmid.txt” and “Modify filmid.txt”
  10. Step !MANDATORY!
    1. Create a file named history.txt in directory lab3, which contains the output of history
      1. Example: when in directory lab3 then enter command history > history.txt
    2. SS “Add history.txt”
  11. Step !MANDATORY!
    1. Upload all changes to gitlab using Git command

Example output from your commits view at gitlab.pld.ttu.ee:

Commit history
Commit history