# Lab 2: Working with Git

In this lab you get a better understanding of how Git works.

## Git tutorial

Open up this interactive Git tutorial and do the 4 lessons under "Introduction Sequence", as well as the 8 lessons under the "Remotes" tab: "Push & Pull -- Git Remotes!"

### Tips

- The tutorial has keyboard commands for most actions:
  - `reset`
  - `undo`
  - `show goal`
  - `hide goal`
  - `show objectives`
  - `levels`
  - `level intro2`
- In the demonstrations, sometimes you have to scroll down to see everything.

### Commands

Here are the commands that are relevant for this tutorial:

- `git commit` - makes a new commit.
- `git branch branchName` - makes a new branch.
- `git branch -f branchName target` - forces the given branch to move to the target commit or branch.
- `git checkout branchName` - changes to the given branch.
- `git checkout -b branchName` - creates and changes to the given branch.
- `git merge branchName` - merges the given branch in with the current one.
- `git rebase branchName` - make it look as though the current branch was derived directly from the given branch.
- `git clone` - makes a local copy of a remote repository
- `git fetch` - updates commits and remote branches according to the remote repository
- `git pull` - does a fetch then merges local with remote branches
- `git pull --rebase` - shorthand for fetch and rebase
- `git fakeTeamwork [branchName] [numberOfCommits]` - specific to the tutorial: does a commit on the remote repository as if someone else is working on it
- `git push` - uploads your commits to a remote repository

When you are done, show that you have completed the tutorials to get credit.