Welcome! You and your team will collaborate on this recipe collection to practice real-world GitHub workflows.
- Fork this repository to your own GitHub account (click Fork in the top-right corner)
Important: uncheck "Copy the main branch only" so your fork includes all branches
- Clone your fork locally:
git clone https://github.com/your-username/git-collab-recipes cd git-collab-recipes - Verify you have all branches:
git fetch --all git branch -r # you should see fix/improve-formatting and feat/beverages - Read
CONTRIBUTING.txt— it defines the rules your team follows. - Browse the existing recipes in
recipes/to understand the format.
Goal: Add a new recipe using proper team conventions.
Steps:
- Create a branch:
git checkout -b feat/yourname/recipe-name - Add a new recipe
.txtfile inrecipes/— follow the format of existing recipes - Add your name to
CONTRIBUTORS.txt(append at the end) - Add your recipe to
RECIPES_INDEX.txtin alphabetical order by filename - Commit:
git add . && git commit -m "feat: add [recipe name] recipe" - Push and open a Pull Request on GitHub with a clear title and description
Read
CONTRIBUTING.txtfor the exact branch naming and commit format.
Done when: Your PR is open on GitHub with correct branch name, commit message, and description.
Goal: Review a teammate Pull Request and give useful feedback.
Steps:
- Go to the Pull Requests tab on GitHub
- Open a teammate PR (not your own)
- Click Files changed to see what they added
- Hover over a line and click + to leave an inline comment
- Submit your review: Approve or Request changes — always include a reason
- If your PR received a review with requested changes, respond and update
Done when: You have reviewed a teammate PR and your PR has received at least one review.
Goal: Resolve a conflict after two people edited the same file.
Why this happens: Everyone appends their name to CONTRIBUTORS.txt in
Challenge 1. When the second PR tries to merge into main, Git cannot
automatically combine both changes — it needs your help.
Steps:
- After another PR merges into main, pull latest and merge into your branch:
git checkout main && git pull origin main git checkout feat/yourname/recipe-name git merge main - Open
CONTRIBUTORS.txt— find the conflict markers (<<<<<<<,=======,>>>>>>>) - Resolve: keep all names (yours and your teammates), remove the markers
- Commit and push:
git add CONTRIBUTORS.txt git commit -m "fix: resolve conflict in contributors list" - Push and merge your PR
Done when: Your PR is merged and CONTRIBUTORS.txt contains all team names.
Goal: Save work in progress, handle an urgent fix, then come back.
Scenario: You are mid-way adding a second recipe (file created, not
committed yet). The team noticed a typo in recipes/pasta-carbonara.txt —
line 6 says "guancale" but it should be "guanciale". Fix it without losing
your work in progress.
Steps:
- Start adding a second recipe — create the
.txtfile but do not commit - Save your work in progress:
git stash push -m "wip: adding [your recipe name]" - Verify:
git stash list - Switch to main, pull, and create a hotfix branch:
git checkout main && git pull origin main git checkout -b fix/yourname/carbonara-typo - Fix the typo in
recipes/pasta-carbonara.txt(line 6: guancale → guanciale) - Commit, push, open PR, and merge:
git add recipes/pasta-carbonara.txt git commit -m "fix: correct guanciale spelling in carbonara" git push origin fix/yourname/carbonara-typo - Return to your feature branch and restore your stash:
git checkout feat/yourname/second-recipe-branch git stash pop
- Continue and commit your second recipe
Done when: The typo is fixed in main AND your second recipe is committed.
Goal: Apply one specific commit from another branch — without merging the whole branch.
Context: The branch fix/improve-formatting has one commit that adds a
RECIPE_TEMPLATE.txt file. You want that file on your branch too, without
merging everything else from that branch.
Steps:
- Find the SHA of the commit you want:
git log origin/fix/improve-formatting --oneline
- Apply that single commit to your current branch:
git cherry-pick <SHA>
- Verify:
RECIPE_TEMPLATE.txtshould now exist in your branch
Done when: RECIPE_TEMPLATE.txt appears in your branch via cherry-pick.
Goal: Update a feature branch with the latest main commits — keeping a clean, linear history.
Context: The branch feat/beverages was created before some recent
commits on main. It is behind by 3 commits. Instead of merging main into it
(which creates an extra merge commit), use rebase.
Steps:
- Create a local copy to work with:
git checkout -b feat/yourname-beverages origin/feat/beverages
- Rebase onto main:
git rebase main
- Verify linear history — main commits followed by the smoothie commit on top:
git log --oneline
- Push your branch:
git push origin feat/yourname-beverages
Done when: Your branch shows a linear history with all main commits followed by the smoothie commit.
| Concept | Command |
|---|---|
| Save WIP | git stash push -m "message" |
| List stashes | git stash list |
| Restore WIP | git stash pop |
| Cherry-pick | git cherry-pick <sha> |
| Rebase onto main | git rebase main |
| Safe force push | git push --force-with-lease |