Welcome to the interactive portion of the workshop! Follow the steps below at your own pace. Don't worry if something goes wrong — that's what git is for.
- Fork this repo and make your first commit
- Open a Pull Request
- Sync your fork with the original repo
- Create a merge conflict (on purpose!) and resolve it
Step 1 — Fork the repo
- On this repo's GitHub page, click the Fork button (top right)
- Choose your personal account as the destination
- GitHub will create a copy of this repo under your username
Step 2 — Clone your fork locally
- On your forked repo page, click the green Code button and copy the URL
- In GitHub Desktop: File → Clone Repository → paste the URL
- Choose a local folder and click Clone
Step 3 — Create your file
- Open the cloned folder on your computer
- Create a new file named exactly
{github_username}.txt(replace{github_username}with your actual GitHub username — e.g.octocat.txt)- Inside the file, type:
Hello, Git!- Save the file
Step 4 — Commit the file
- In GitHub Desktop: your new file will appear in the Changes panel on the left
- At the bottom left, type a short commit message (e.g.
Add octocat.txt)- Click Commit to main
Step 5 — Push to GitHub
- Click Push origin (top bar) to send your commit up to your fork on GitHub
Step 6 — Open a Pull Request
- Go to your fork on GitHub (github.com/your-username/git_workshop)
- You should see a banner: "This branch is 1 commit ahead" — click Contribute → Open pull request
- Make sure the base repo is the original repo (the workshop one), not your fork
- Give your PR a title and click Create pull request
- 🎉 You've opened your first PR!
Step 1 — Fork the repo
- On this repo's GitHub page, click the Fork button (top right)
- Choose your personal account as the destination
Step 2 — Clone your fork locally
git clone https://github.com/{github_username}/git_workshop.git cd git_workshop
Step 3 — Create your file
# Replace {github_username} with your actual GitHub username echo "Hello, Git!" > {github_username}.txtOr create and edit the file manually in any text editor — just make sure it's named
{github_username}.txtand containsHello, Git!
Step 4 — Stage and commit the file
git add {github_username}.txt git commit -m "Add {github_username}.txt"
Step 5 — Push to GitHub
git push origin main
Step 6 — Open a Pull Request
- Go to your fork on GitHub (github.com/{github_username}/git_workshop)
- Click Contribute → Open pull request
- Make sure the base repo is the original workshop repo
- Give your PR a title and click Create pull request
Once a few PRs have been merged into the original repo, your fork will be out of date. Here's how to sync it back up.
- On your fork's GitHub page, look for the "This branch is X commits behind" message
- Click Sync fork → Update branch
- In GitHub Desktop, click Fetch origin, then Pull origin to bring those changes down to your local machine
Add the original repo as a remote called
upstream(you only need to do this once):git remote add upstream https://github.com/owhite7128/git_workshop.gitFetch and merge the latest changes from upstream:
git fetch upstream git merge upstream/main git push origin mainYour fork is now up to date with everyone else's changes.
Time to break something — intentionally. This is how you learn to fix it.
You're going to create two different changes to the same line of your .txt file — one on main, one on a new branch — and then try to merge them together. Git won't know which to keep, so it'll ask you to decide. That's a merge conflict.
Step 1 — Create a branch (don't switch to it yet)
- In GitHub Desktop: Branch → New Branch → name it
conflict-branch→ click Create Branch- When asked, choose "Leave my changes on main" (or similar) — you want to stay on
mainfor now- Confirm you're still on
main— check the branch name shown in the top bar
Step 2 — Edit your file on main
- Open
{github_username}.txtin a text editor- Add a new line with something coy — for example:
Hello, Git! I heard you like commits.- Save the file
- In GitHub Desktop: commit this change with a message like
A coy message on main- Push to origin
Step 3 — Switch to your branch and make a conflicting change
- In GitHub Desktop: click the branch dropdown and switch to
conflict-branch- Open
{github_username}.txtagain — notice your coy message isn't there (you're on a different branch!)- Add a new line that says:
Hello, Git! Merge Conflict- Save, commit with a message like
Conflicting change on branch, and push
Step 4 — Merge the branch into main and resolve the conflict
- Switch back to
mainin the branch dropdown- In GitHub Desktop: Branch → Merge into Current Branch → select
conflict-branch→ click Merge- GitHub Desktop will tell you there's a conflict. Click Open in editor (or open the file manually)
- Your file will look something like this:
Hello, Git! <<<<<<< HEAD I heard you like commits. ======= Merge Conflict >>>>>>> conflict-branch- Edit the file to keep what you want (you can keep one, both, or rewrite entirely). Remove the
<<<<<<<,=======, and>>>>>>>lines — those are git's markers, not content- Save the file
- In GitHub Desktop: the file should now show as resolved — commit the merge
Step 1 — Create a branch without switching to it
git branch conflict-branchYou're still on
main. Confirm with:git branch # The * shows your current branch
Step 2 — Edit your file on main Open
{github_username}.txtand add a new line with something coy:Hello, Git! I heard you like commits.Then commit:
git add {github_username}.txt git commit -m "A coy message on main"
Step 3 — Switch to the branch and make a conflicting change
git switch conflict-branchOpen
{github_username}.txt— your coy line isn't here. Add this instead:Hello, Git! Merge ConflictCommit it:
git add {github_username}.txt git commit -m "Conflicting change on branch"
Step 4 — Switch back to main and merge
git switch main git merge conflict-branchGit will tell you there's a conflict:
CONFLICT (content): Merge conflict in {github_username}.txt Automatic merge failed; fix conflicts and then commit the result.
Step 5 — Open the file and resolve it Your file will look like this:
Hello, Git! <<<<<<< HEAD I heard you like commits. ======= Merge Conflict >>>>>>> conflict-branchEdit it to keep what you want, and delete all three marker lines (
<<<<<<<,=======,>>>>>>>). Then:git add {github_username}.txt git commit -m "Resolve merge conflict"🎉 You resolved your first merge conflict.
| What you did | CLI command |
|---|---|
| Clone a repo | git clone <url> |
| Check current branch | git branch |
| Stage a file | git add <filename> |
| Commit staged changes | git commit -m "message" |
| Push to GitHub | git push origin main |
| Create a branch | git branch <name> |
| Switch branches | git switch <name> |
| Merge a branch | git merge <name> |
| Add upstream remote | git remote add upstream <url> |
| Fetch from upstream | git fetch upstream |
Made with ❤️ for the Git + GitHub workshop.