diff --git a/Github-Activity/Afternoon/class-roster.md b/Github-Activity/Afternoon/class-roster.md new file mode 100644 index 0000000..e69de29 diff --git a/Github-Activity/Afternoon/solo/.placeholder b/Github-Activity/Afternoon/solo/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/Github-Activity/Morning/class-roster.md b/Github-Activity/Morning/class-roster.md new file mode 100644 index 0000000..e69de29 diff --git a/Github-Activity/Morning/solo/.placeholder b/Github-Activity/Morning/solo/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/Github-Activity/Morning/solo/heathfry.txt b/Github-Activity/Morning/solo/heathfry.txt new file mode 100644 index 0000000..f75049e --- /dev/null +++ b/Github-Activity/Morning/solo/heathfry.txt @@ -0,0 +1 @@ +heath fry diff --git a/Github-Activity/README.md b/Github-Activity/README.md new file mode 100644 index 0000000..edcb4c9 --- /dev/null +++ b/Github-Activity/README.md @@ -0,0 +1,156 @@ +# Github-Activity +# COMP301 Git Activity + +Welcome to our collaborative Git exercise! In this activity, you will first work independently, then in pairs and teams, to practice branching, committing, resolving merge conflicts, and making pull requests. + +--- + +## What You Will Learn + +- Creating and pushing branches. +- Making pull requests to a protected main branch. +- Working with shared files in a team. +- Encountering and resolving merge conflicts. +- Organizing contributions from many people into one shared project. + +--- + +## Part 1: Individual Contribution (No Conflicts) + +**Setup remotes (run once per local clone):** +```bash +# already set automatically when you clone YOUR fork +git remote -v + +# add the class repo as 'upstream' +git remote add upstream https://github.com//.git +git fetch upstream +``` + +**Keep your fork up to date (before new work):** +```bash +git checkout main +git fetch upstream +git merge --ff-only upstream/main +git push origin main +``` + +1. Make a fork of this repository on your local GitHub account and clone it to your computer. +2. You will see folders for the morning section and the afternoon section. Choose the appropriate folder to work in. +3. Create a new branch named `solo/`. +4. Now navigate to the `solo/` folder (unrelated to branch name). Inside it, create a new text file named `.txt`. +5. Add your full name inside the file. +6. Stage, commit, and push your branch to your fork on GitHub. +7. Open a pull request **from your fork’s branch** to the **upstream repository’s `main`** with the title `solo: `. + +Each student will have their own file, so there should be no conflicts in this step. + +--- + +## Part 2: Pair and Team Contribution (Designed Conflicts) + +1. Your group of 4–6 students is a **team**. Choose a unique team identifier (for example, `UNC-Alpha`, `Sharks`, `Team42`). + +2. One person in the team acts as **Integrator**. The Integrator’s **fork** will be the team’s working fork. The Integrator: + - Adds teammates as **collaborators** on their fork (Repo → Settings → Collaborators). + - Creates the base branch `team//base` on their fork. + - Creates `teams//roster.md` with: + ``` + # Team Roster (alphabetical by last name) + Members: + ``` + +3. All teammates add the **team remote** (the Integrator’s fork) to their local clones: + ```bash + git remote add team https://github.com//.git + git fetch team + ``` + +4. Each pair branches **from the team base branch** and pushes to the **team remote**: + ```bash + git checkout -b team//pair-- team//base + # edit teams//roster.md (add exactly one line under 'Members:') + git add teams//roster.md + git commit -m "Add + — Team name: " + git push -u team team//pair-- + ``` + + **OR (no collaborator access):** push to your own fork and open a PR **into the Integrator’s fork base branch**. + +5. The Integrator opens PRs (or reviews incoming PRs) from each pair branch **into** `team//integration` (created from `team//base`). Resolve conflicts as specified. + +--- + +## Part 3: Conflict Resolution and Integration + +1. The Integrator should create a new branch `team//integration` from the base on their fork. +2. Then, merge each pair branch into the integration branch, one by one. + - This will cause conflicts in the `roster.md` file. + - Resolve the conflicts by keeping only one `Members:` header, then making sure all lines are included. + - The final list of pairs must be in **alphabetical order by last name**. + - Each line must show both names and the team name. +3. After all conflicts are resolved and merged, push the integration branch. + +--- + +## Part 4: Class Roster Pull Request + +1. The Integrator should append the team’s final roster to the file `class-roster.md`. + - Add a section starting with `## ` followed by the list of pairs. +2. Commit and push the update to the integration branch on their fork. +3. Open a pull request **from the Integrator’s fork** `team//integration` **to** the **upstream repository’s `main`** with the title ` → class-roster`. + +--- + +## Quick Reference (Commands in Alphabetical Order) + +- `git add ` — stage changes to be committed. +- `git branch -vv` — show local branches and their remote tracking. +- `git checkout -b ` — create and switch to a new branch. +- `git checkout ` — switch to an existing branch. +- `git clean -fd` — remove untracked files and folders (use with caution). +- `git clone ` — clone the repository to your computer. +- `git commit -m ""` — commit staged changes with a message. +- `git diff` — show unstaged changes. +- `git diff --staged` — show staged but uncommitted changes. +- `git fetch --all` — fetch all updates from remote branches. +- `git log --oneline --graph --decorate --all` — visualize branch history. +- `git merge ` — merge another branch into your current branch. +- `git merge --abort` — cancel a merge attempt. +- `git pull --ff-only` — update your branch with the latest changes from remote. +- `git push -u origin ` — push your branch to GitHub and set upstream. +- `git reflog` — view recent HEAD movements to recover from mistakes. +- `git remote add upstream ` — add the class repo as upstream. +- `git remote add team ` — add the Integrator’s fork as team. +- `git reset --hard origin/main` — reset your branch to match your fork’s main branch. +- `git restore ` — discard changes to a file before staging. + +**Update local main from upstream:** +```bash +git checkout main +git fetch upstream +git merge --ff-only upstream/main +git push origin main +``` + +--- + +## Common Mistakes + +1. **Confusing branch names with folder names.** +Remember: `solo/{{ONYEN}}` is the branch name; `solo/` is the folder. Both are required. + +2. **Forgetting to pull the latest changes before branching or merging.** +Always run `git pull --ff-only` on `main` or your base branch to avoid diverging histories. + +3. **Leaving merge conflict markers in files.** +Always remove `<<<<<<<`, `=======`, and `>>>>>>>`. Ensure the final `roster.md` is clean and alphabetized. + +--- + +## Extra Debugging Commands + +- `git status` — check current branch and file state. +- `git log` — view commit history. + +---