Choose One of Three Exercise Routes

OPTION A: NEW PROJECT (BEGINNER)

Create a repository on GitHub, clone it, and practise the basic workflow

Continue to slide 2

OPTION B: EXISTING FOLDER (BEGINNER)

Put an existing course or research folder under Git and connect it to GitHub

Continue to slide 3

OPTION C: FORK (ADVANCED)

Fork a large repository and complete the full branch-and-review workflow

Continue to slide 4

Option A: Create on GitHub, then clone

GITHUB FIRST

  1. On GitHub, select New repository and name it git-workshop-sandbox
  2. Add a README, create the repository, and copy its HTTPS URL
  3. In the terminal:
git clone <url>
cd git-workshop-sandbox
git status
  1. Edit README.md and create notes.txt, then record and publish them:
git diff
git add README.md notes.txt
git diff --staged
git commit -m "Add workshop notes"
git push

Option B: Put an existing folder under Git

LOCAL FOLDER FIRST

  1. Open the folder in the terminal and inspect it before staging anything:
cd <project-folder>
git init
git status
  1. Add a README.md and .gitignore. Exclude confidential data, credentials, large raw data, and generated clutter
  2. Record a small, deliberate first snapshot:
git add README.md .gitignore
git diff --staged
git commit -m "Initialize research project"
  1. Create a new empty GitHub repository, then connect and publish:
git branch -M main
git remote add origin <url>
git push -u origin main

Option C: A fork gives you a writable copy

UPSTREAM
the original project

YOUR FORK
your GitHub copy

LOCAL CLONE
your working copy

  1. Open the chosen repository and select Fork → Create fork
  2. Clone your fork in the terminal:
git clone --depth=20 --sparse https://github.com/<github-user>/<repository>.git
cd <repository>
git remote add upstream https://github.com/<owner>/<repository>.git

Success check · git remote -v shows origin for your fork and upstream for the original

Wrong URL? git remote set-url origin <your-fork-url>

C, Task 1: Build a repository map

QUESTION

Where am I, what happened before, and where would a push go?

git status
git log --oneline -5
git branch --show-current
git remote -v

Tell your neighbor the current branch, latest commit, and the two remotes

C, Task 2: Record a focused change

CHANGE

Create workshop/field-note.md with the project name and one thing you learned from its README

git status
git diff
git add workshop/field-note.md
git diff --staged
git commit -m "Add workshop field note"

The first git diff may be empty because Git does not show untracked file content

C, Task 3: Separate signal from scratch work

SELECT

Edit field-note.md. Also create workshop/scratch.txt, then commit only the useful note

git add workshop/field-note.md
git diff --staged
git commit -m "Clarify workshop observation"
git status

Remove the untracked scratch file in your editor or file explorer

C, Task 4: Isolate an idea on a branch

BRANCH

Create a branch and add one concrete improvement you would propose for the project documentation

git switch -c workshop-recommendation
# edit workshop/field-note.md
git add workshop/field-note.md
git commit -m "Add documentation recommendation"
git push -u origin workshop-recommendation

C, Task 5: Complete the review loop

REVIEW

On GitHub, open a pull request inside your fork:

base: <you>/<repository>:main
compare: <you>/<repository>:workshop-recommendation

Read Files changed, merge the pull request, then update locally:

git switch main
git pull --ff-only origin main
git status
git log --oneline --graph --all -8