Git Version Control

Projected Time

About 2.5 hours

Prerequisites

Learning styles represented

Motivation

Imagine you are coloring on a flower coloring book. You colored in green for all leaves and now it’s time for the best part, the petal. You know you enjoy red the best but it looked horrible after you finished it. With Git, you can revert your choice of red in a heartbeat and you are free to reapply the red if you change your mind. A work doesn’t have to be permanent; every action is recorded and reversible. (Source: https://dev.to/maestromac/comment/him)

Which companies use Git?

Objectives

Participants will be able to:

Specific Things to Learn

Materials

Video Tutorial on setup and basic terminal work-flow

Video Tutorial on Forking and Pull Request

Lesson

Git and Version Control (video walkthrough of slides)

Git and Version Control (slides)

Common Mistakes / Misconceptions

Demonstration

Instructor will demonstrate:

Guided Practice

Techtonica staff will assign pairs. Go through the following steps on one pair partner’s computer first, then go through all the steps again the other pair partner’s computer. The repetition of doing this twice will help solidify the new concepts.

  1. Launch your Terminal and run git --version. If a version number appears, you already have git installed. If a version number does not appear:
  2. Using the Terminal, navigate to the Desktop.

  3. Create a new folder called git_example. Navigate to this folder.

  4. Run the git status command. What happens? Run the git init command to make git_example start keeping track of changes that happen within the folder.

  5. Run git status. What do you see?

  6. Create a new file in git_example called my-favorite-animals.txt.

  7. Run git status. What do you see?

  8. Add some text to my-favorite-animals.txt. Save the file.

  9. Run git status. What do you see?

  10. Run git add my-favorite-animals.txt.

  11. Run git status. What do you see?

  12. Run git commit -m "Create new file..

  13. Run git status. What do you see?

Independent Practice

Spend just 30 minutes working through Git Immersion: A guided tour that walks through the fundamentals of Git, then stop wherever you are. If the first page takes more than a minute to figure out, you can skip it for now.

Group Practice

With computers closed, participants as a group will guide the instructor through creating, adding and committing file changes using Git.

Challenge

  1. Using only the command line:
  1. Play through githug, a command-line game for learning git. After installing it, type githug in your command-line prompt to play. When you think you’ve solved a level, type githug again to check your work. You’ll get feedback and hints. Please complete at least up to #32: checkout and return to the game throughout the program to practice things like merge and rebase.

Check for Understanding

Form small groups and discuss:

Extensions

If you have time, continue the Git Immersion and githug tutorials if you aren’t finished. Also try looking through the supplemental materials. be)

Supplemental Materials