Skip to content
Snippets Groups Projects

Git Command Line Basics - Exercises

Add contents to your local repository

Add an entry to your animal description file, as well as an image to the images folder.

Commit the changes to your local repository

  1. Check with status that the next commit matches what you expect.
  2. Run the commit.
  3. Display the log to check the commit has been added to your local history track.

Propagate the changes to your repository on GitLab

  1. Push your recent commits the local repository to the remote repository.
  2. Check your project page on GitLab to verify the push went as expected.

Shuffle contents of your local repository

  1. Rename the image file you recently added by adding _01 before the extension (i.e. bumblebee.jpg becomes bumblebee_01.jpg)
  2. Add a new image file for the same animal with a filename including _02 (i.e. bumblebee_02.jpg) If you can't find one you can cheat and copy the first image.
  3. Add a file called mistake.md with some text contents of your choice.
  4. Commit all your latest changes.
  5. Check with status and log that all went as expected.
  6. Remove the mistake.md file.
  7. Commit all your latest changes.
  8. After checking all went well, propagate the changes to the remote GitLab project.

Synchronize your local repository afer making changes to the remote repository

  1. Using the GitLab Web interface, make some changes to your remote repository (add an entry to the .md file, and add an image).
  2. On your workstation, in your local repository:
    1. Fetch the latest commit(s) from the remote repository.
    2. Check that your local repository is at least one commit behind.
    3. Synchronize your local repository with the latest commits from the remote repository.