PLAN-101 Career OS
Intermediate 45 Minutes

Git Branches, Pull Requests and Conflict Resolution

Practice a two-branch feature workflow and understand why a conflict must be resolved by reading the intent of both changes.

Key Learning Objectives

  • Read working-tree status before committing.
  • Describe branch pointers and commits.
  • Resolve a real content conflict.
  • Explain the purpose of pull-request review.

A commit is a snapshot with history

Git tracks snapshots of files over time. The working tree is what you are editing; the staging area is the next proposed snapshot; a commit records the staged snapshot with parent history. A branch is a movable name for a commit, not a complete copy of every file. Use git status before and after each operation to understand what will be included.

Use branches to isolate a small change

A normal contribution starts with an up-to-date main branch, creates a feature branch, adds a focused commit, and opens a pull request. The reviewer should be able to understand intent, test impact and suggest improvements. Keep generated secrets and local environment files out of version control. Avoid force-pushing a shared branch without coordination.

git switch -c feat/study-checklist
git status
git add src/checklist.ts
git commit -m "Add checklist validation"
git push -u origin feat/study-checklist

Each step has a distinct role: isolate, inspect, stage, record, and share for review.

A merge conflict is a decision, not a syntax puzzle

Conflicts arise when Git cannot safely combine edits in the same region. Read both sides and decide the correct merged behavior, then test it. Removing conflict markers alone is not sufficient. After resolving, inspect the diff to ensure no behavior was accidentally lost. Do not use hard resets to make a conflict disappear when the work includes changes you need to preserve.

Build It: Two-feature branch simulation

Make competing edits to one function on two branches, merge them, and explain the final behavior.

Project Deliverables

  • A repository with meaningful commits.
  • A deliberate conflict and resolved result.
  • A short PR description with test notes.

Acceptance Criteria

  • No conflict markers remain.
  • Both desired behaviors are preserved.
  • History and README explain the change.

Next Steps & Related Learning

This interactive lesson is part of the Git & GitHub curriculum. Continue exploring or try another interactive lesson:

View Full Git & GitHub → Arrays, Contiguous Memory & Hash Tables → JavaScript Asynchronous Execution & V8 Event Loop → Relational Database Architecture, B-Trees & Query Optimization → Semantic HTML, Accessible Forms & Document Structure → Python Functions, Dictionaries and Reliable Data Processing → SQL Joins, Missing Rows and Query Correctness → React State, Events and Derived UI → Designing a Task API: HTTP Methods, Errors and Validation → Sliding Window: From Quadratic Loops to a Linear Scan → Responsive CSS Layout: Flexbox, Grid and Fluid Constraints → TypeScript Union Types and Runtime Narrowing → Docker Images, Containers and Reproducible Builds → Graph Traversal: BFS, DFS and Visited Sets → AWS IAM: Least Privilege and Secure Cloud Access → API Pagination, Error Contracts and Safe Retries →