Skip to content

Git 101

git meme


Level: Beginner Offerred: Fall 2025 Time: 1-1.5 hours

Slide deck

Workshop recording

Git cheat sheet

This workshop is designed for both beginner and intemediate Git users. Even if you are familiar with Git, mastering the collaborative aspects of version control is essential for effective for working on softtware projects in a team.

To complete this workshop, follow along in the slides and complete the tasks on your computer as they appear. Good luck!


  • Create a GitHub Account
    • Go to GitHub and sign up for a free account
    • If you already have an account, make sure you can log in
  • Install Git
    • Check if you have git installed
      Terminal window
      git --version
    • If not, download Git for your OS
  • Have an IDE or text editor
    • We use VS Code, but Vim, Emacs, or even Notepad will work

1. Create a New Repository on GitHub

  • Go to GitHub

  • Click the New button or navigate directly to https://github.com/new

    New Repository

  • Fill in the repository name and an optional description

  • Choose the repository visibility (Public or Private). We will use Public for this workshop (to avoid having to setup an SSH Key)

    Repository Visibility

  • Click Create repository to finish setting it up

2. Clone the Repository Locally

  • Copy the repository URL (choose HTTPS or SSH) from the GitHub page.

    Repository Clone

  • Open a terminal and run the following command to clone the repository:

    Terminal window
    git clone <repository_link>
    • Replace <repository_link> with the URL you copied

    Repository Clone 2

3. Navigate to the Cloned Repository

  • After cloning, move into the repository directory:

    Terminal window
    cd <repository_name>
    • Replace <repository_name> with the name of your repository.

1. Create New Files Create a simple text file and a README file inside your cloned repository:

Terminal window
echo "Hello, world!" > hello.txt
echo "# My First Repository" > README.md

This creates two files: hello.txt and README.md.

2. Check the Repository Status See which files have been added or changed:

Terminal window
git status

3. Add Files to the Staging Area

You have two options:

  • Add a specific file:
Terminal window
git add README.md

This only stages README.md.

  • Or add all changed files at once:
Terminal window
git add .

This stages both hello.txt and README.md, and any other new or changed files.

4. Commit the Changes Create a commit with a clear message:

Terminal window
git commit -m "Add hello.txt and README.md"

5. Push the Commit to GitHub Send your changes to the remote repository:

Terminal window
git push

6. Verify Go to your GitHub repository page and check that both hello.txt and README.md are there.

Task 3: Create a New Branch, Work Independently, and Tag a Release

Section titled “Task 3: Create a New Branch, Work Independently, and Tag a Release”

This task will help you practice managing your own work safely in a repository before collaborating with others.

1. Create a New Branch Create a new branch to safely test changes without affecting the main branch:

Terminal window
git checkout -b solo-changes

2. Create a .gitignore File A .gitignore file tells Git to ignore specific files or folders you do not want to track.
Create a simple .gitignore:

Terminal window
echo "*.log" > .gitignore

This will ignore any files ending with .log.


3. Make and Track Changes

  • Add .gitignore to the staging area:
Terminal window
git add .gitignore
  • Commit it:
Terminal window
git commit -m "Add .gitignore to ignore .log files"

Now, create a dummy .log file to test .gitignore:

Terminal window
echo "Temporary log data" > temp.log

Check that temp.log does not appear in git status.
This shows .gitignore is working!


4. Edit Another File Make a simple change to hello.txt:

Terminal window
echo "More text added during solo branch work." >> hello.txt

Stage and commit it:

Terminal window
git add hello.txt
git commit -m "Update hello.txt with more text"

5. Merge Your Solo Work Back into Main Switch back to the main branch:

Terminal window
git checkout main

Pull latest changes (just in case):

Terminal window
git pull

Merge your solo branch:

Terminal window
git merge solo-changes

6. Push Your Updated Main Branch Push your changes to GitHub:

Terminal window
git push

Task 3 Complete:
You created a safe solo workflow, set up a .gitignore, and merged without conflicts.


Task 4: Collaborate, Merge Feature Branches Together, and Submit a Pull Request

Section titled “Task 4: Collaborate, Merge Feature Branches Together, and Submit a Pull Request”

This task simulates real teamwork where multiple developers’ branches must be merged before submitting to main.


1. Find a Partner Pair up with someone else in the workshop. You will continue working inside your original repository.

Important: Only the repository owner needs to invite the other as a collaborator.

  • Go to your GitHub repository page.
  • Click Settings > Collaborators > Add people.
  • Invite your partner using their GitHub username.
  • The invited partner must accept the invitation.

2. Set Up Locally

  • Repository owner: continue working in your existing repository.
  • Invited partner: clone the repository and navigate into it:
Terminal window
git clone <repository_link>
cd <repository_name>

3. Each Partner Creates Their Own Feature Branch Each person creates a feature branch:

Terminal window
git checkout -b feature-[yourname]

4. Each Partner Makes Different Changes

On your own feature branch:

  • Create a new .txt file with your name:
Terminal window
echo "Notes from [Your Name]" > yourname_notes.txt
  • Edit the README.md file — edit the same section (e.g., first paragraph) so that a merge conflict happens later.

5. Add, Commit, and Push Your Feature Branch

Terminal window
git add .
git commit -m "Feature work by [your name]"
git push origin feature-[yourname]

6. One Partner Merges Both Feature Branches Together Locally

Pick one partner to be the integrator.

The integrator must:

  • Pull the other partner’s branch into their local repository:
Terminal window
git fetch origin feature-partner2
git checkout feature-partner1 # stay on their own feature branch
git merge origin/feature-partner2

7. Resolve Merge Conflicts Locally (If Any)

If a conflict happens (likely in README.md):

  • Git will show you the conflict.
  • Use a merge editor (VS Code or CLI) to resolve it:
    • Keep important parts from both versions.
    • Make the file clean and correct.
  • After fixing conflicts:
Terminal window
git add .
git commit -m "Merge feature-partner2 into feature-partner1"

8. Push the Combined Feature Branch

After merging and resolving conflicts:

Terminal window
git push origin feature-partner1

This now holds both people’s work.


9. Create a Single Pull Request Into Main

  • Go to GitHub.
  • Open a pull request:
    • From feature-partner1
    • Into main
  • Title: “Combined Feature Work from Partner 1 and Partner 2”
  • Description: explain what changes were made by each partner.

10. Review and Merge the Pull Request

  • Review the pull request carefully.
  • Approve and merge it.
  • Delete the merged feature branch if desired.

11. Everyone Pulls the Updated Main

After merging the PR:

Terminal window
git checkout main
git pull

Clean up local branches:

Terminal window
git branch -d feature-partner1
git branch -d feature-partner2


Why this matters:
In real projects, teams often merge and test each other’s branches together before opening one clean pull request into main, reducing merge noise and improving code quality.


The slide deck and writeup were created by Alex Aylward. Exercises were created and documented by Trevor Antle.