• πŸ“Š Summary Table
  • βœ… Best Practices
  • πŸ§‘β€πŸ’» GitHub Workflow Guide

    GitHub is more than just a place to store code β€” it’s where real collaboration happens. In our class, you’ll use GitHub to build your portfolio, launch projects, and collaborate on lessons. This guide walks you through the typical use cases.


    πŸ”‘ Key GitHub Workflows

    Following are some use cases that we expect students will follow during their coursework.


    πŸ“˜ Reference Repository

    A read-only public repository used for:

    • Cloning to your local machine
    • Studying code and structure
    • Testing or running locally without contributing back

    πŸ’‘ Example: The pages repository you clone to follow the instructor’s lessons.


    πŸ‘€ Owner / Collaborator

    You can:

    • Edit files directly
    • Push and merge branches
    • Use GitHub Actions to publish your site or project

    πŸ’‘ Example: Your Portfolio repository, created from a student-template repo. You will:

    • Become the Owner of your copy
    • Update content to reflect your work and progress
    • Use GitHub Pages to publish your portfolio website

    🍴 Fork β†’ 🌿 Branch β†’ πŸ“¬ Pull Request

    • Fork: Copy the repository to your own GitHub account
    • Branch: Make a new branch to isolate your changes


    πŸ§ͺ Practice: Fork and Branch Workflow

    Now let’s practice the fork and branch workflow with an interactive GitHub simulator.

    github.com
    upstream-user / learning-merge-conflicts
    β‘‚ Fork
    πŸ“„ Public repository
    A sample repository for learning merge conflicts
    github.com
    your-username / learning-merge-conflicts
    βŽ‡ main β–Ό
    Switch branches/tags
    βœ“ main
    3 files
    πŸ“„ README.md
    πŸ“„ app.js
    πŸ“„ styles.css

    πŸ”€ Why Resolving Merge Conflicts Matters

    Understanding merge conflicts is critical for effective collaboration:

    • Code Integrity: Improper conflict resolution can introduce bugs, break functionality, or lose important changes
    • Version Control: Understanding conflicts helps you better understand how Git tracks and merges changes across branches
    • Professional Development: Merge conflict resolution is a fundamental skill for any developer working in collaborative environments

    🎯 Practice: Merge Conflict Resolution

    Ready to practice? Work through these interactive merge conflict scenarios:

    Scenario 1 of 5

    Scenario 1: Simple Text Conflict in README.md

    Two developers changed the project description simultaneously.

    Instructions: Remove the conflict markers (<<<<<<<, =======, >>>>>>>) and keep the better description or combine both.
    Hint: Both descriptions have useful information. Consider combining them:
    "This project is a web application for managing tasks and todos with collaboration features."

    Make sure to delete all three conflict markers: <<<<<<< HEAD, =======, and >>>>>>> feature-branch
    βœ“ Conflict resolved correctly!
    βœ— Conflict markers still present. Remove all <<<, ===, and >>> markers.

    Scenario 2: Function Logic Conflict in app.js

    Two developers implemented the same function differently.

    Instructions: Choose the better implementation or combine them.
    Hint: The reduce method is more concise and modern JavaScript.
    Keep: return items.reduce((sum, item) => sum + item.price, 0);
    βœ“ Conflict resolved correctly!
    βœ— Conflict markers still present.

    Scenario 3: CSS Styling Conflict in styles.css

    Different styling approaches for the same element.

    Hint: The feature-branch version has modern styling with gradient and border-radius.
    βœ“ Conflict resolved correctly!
    βœ— Conflict markers still present.

    Scenario 4: Multiple Conflicts in config.js

    Multiple sections have conflicts.

    Hint: TWO conflicts! Use localhost for dev, keep retries: 3 and logLevel: 'debug', but add cacheEnabled: true
    βœ“ All conflicts resolved!
    βœ— Conflict markers still present.

    Scenario 5: Package Dependencies Conflict

    Both branches added different dependencies.

    Hint: Keep ALL dependencies in alphabetical order: axios, dotenv, express, lodash, mongoose
    βœ“ Conflict resolved!
    βœ— Conflict markers still present.

    πŸ”— Real-World Practice Repository

    Ready to practice with a real GitHub repository?

    Click here to access the Merge Conflict Practice Repository β†’

    This repository contains intentional merge conflicts for you to resolve through pull requests, just like in real-world development.


    When collaborating in groups, you can either:

    • All be collaborators in one shared repository, or
    • Use a fork-and-pull request model where one student (the Scrum Master) owns the repository and others contribute via PRs.

    πŸ‘‘ Owner / Scrum Master

    • Has direct permissions to merge pull requests and manage settings
    • Uses GitHub Actions to deploy the app or site to the instructor and community

    ✍️ Contributors

    • Fork the project repository
    • Work on the main or feature branches

    One student (Emma) is the Scrum Master and manages the main project repo. Other students create branches like noah-authentication or jessica-homepage, and open PRs to merge their features into the main branch.


    πŸ“Š Summary Table

    Use Case Source Repo Your Role Workflow Type Contributions Publishing
    Portfolio student Owner Direct (own repo) Direct edits GitHub Pages
    Lesson pages Contributor Fork β†’ PR Pull requests Instructor merges
    Project starter_flask Owner Clone β†’ Push Personal project GitHub Pages/API
    Reference Code pages Reader Clone only No changes Local only

    βœ… Best Practices

    • Commit messages should be meaningful:
      Add login page and route handling
    • Never work directly on main unless you’re the sole owner
    • Use branches for features, fixes, or lessons
    • Pull before you push to avoid merge conflicts
    • Use issues, Kanban boards, and PRs to organize group work
    • Review PRs and add feedback before merging
    • Small and Feature-Specific PRs: Keep pull requests focused on a single feature or fix. This makes reviewing easier and allows for quick rollbacks if something breaks.

    All Guides