Git and GitHub Exercises#

Getting Started with Git#

Exercise 18

  1. Start a repository in a new directory.

  2. Create a new file in your new Git repository. Make sure Git is tracking the file and then create a new commit.

  3. Make changes to the file, and then commit these changes.

  4. Add two new files to your repository, but only commit one of them. What is the status of your repository after the commit?

  5. Undo the last commit, add the untracked file, and redo the commit.

Important Git Features#

Exercise 19

  1. Look at the help pages for git log and git diff.

  2. Add to the .gitignore you already started to include a specific file name, then add that file to your repository.

  3. Create a file that contains the Git log for this repository. Use grep to see which day of the week most of the commits occurred on.

Branching#

Exercise 20

  1. Start a new branch.

  2. Switch to that branch and add commits to it. Switch to an older branch and then merge the new branch into your current branch.

  3. Purposefully create and resolve a merge conflict.

GitHub#

Exercise 21

  1. Create a new repository on GitHub. Clone your repository and add a README.md file. Push this file to GitHub and create a GitHub Pages website for this repository.

  2. Fork an existing repository (try one of mine: seankross) and try to identify something valuable you could contribute. Make changes or additions to that repository, then open a pull request.

  3. Read through GitHub’s Guides.