> Canonical URL: https://codingcat.dev/course/odin-git-and-github-workflows/lesson/branching-merging-and-rebasing-without-fear

# Branching, Merge Commits vs. Interactive Rebase & Conflict Resolution | The Odin Project 2: Git & GitHub Engineering Workflows | CodingCat.dev Course

[🧶 The Odin Project 2: Git & GitHub Engineering Workflows](/course/odin-git-and-github-workflows)Section 1.2 · Lesson 2 of 2[← Prev Lesson](/course/odin-git-and-github-workflows/lesson/git-internals-commits-trees-and-staging-area)

# Branching, Merge Commits vs. Interactive Rebase & Conflict Resolution

![Branching, Merge Commits vs. Interactive Rebase & Conflict Resolution Architecture Diagram](https://cdn.sanity.io/media-libraries/mlttp0BZbCpV/images/87c098fd543f8e7f7ff29d7690e763dac317a15f-1280x720.jpg?w=1920&h=1080&q=82&fit=max&auto=format)[@CodingCatDev62.5K / 100K Subscribers Goal](https://www.youtube.com/@codingcatdev?sub_confirmation=1)[Subscribe on YouTube→](https://www.youtube.com/@codingcatdev?sub_confirmation=1)[Watch on YouTube App ↗](https://www.youtube.com/watch?v=BDbkM6Fj39M&list=PLCOTCGP0a3VY)

## 1. The 15-Second Hook

Should you merge or rebase? And how do you clean up twelve messy work-in-progress commits before opening a pull request? Let's master interactive rebase and safe conflict resolution.

## 2. Architecture Mental Model (Visual Diagram)

On the left, repeated merge pulls create railroad-track spaghetti logs. On the right, interactive rebase squashes WIP commits into a clean linear history and pushes safely with force-with-lease.

## 3. Show Me the Code (terminal-rebase.sh)

Copied! 🐾📄 terminal-rebase.shtypescript

```
# Fetch latest main and rebase feature branch cleanly
git fetch origin
git rebase -i origin/main

# Safely push rebased feature branch
git push --force-with-lease origin feat/mcp-transport
```

We run git fetch origin followed by git rebase -i origin/main to replay our feature branch on top of main, then push safely using --force-with-lease.

## 4. Production Trade-Off Matrix

Comparing interactive rebase and force-with-lease against raw merge spaghetti, every commit on main remains atomic, buildable, and ready for git bisect.

## 5. Verdict & AJ Pro-Tip

> AJ Pro-Tip: Set git config --global pull.rebase true and rerere.enabled true so Git automatically remembers how you resolved a conflict if you ever rebase the same branch twice.

Rebase your local feature branches to keep history clean, and never force-push shared main. Subscribe to CodingCat.dev and let's cover PR reviews and GitHub Actions next.

✏️ Visual Architecture Diagram

## how this course connects together.

Follow AJ from first principles to production-ready architecture.

Let’s build it!✏️ Visual Diagram: The Odin Project 2: Git & GitHub Engineering Wor…✓ Good PatternVISUAL DIAGRAM[Diagram Walkthrough]Step-by-step diagram breakdown for The Odin Project 2: Git & GitHub Engineering Workflows: Branching, Merge Commits vs. Interactive Rebase & Conflict Resolution: start with Core Architecture & Implementation, implement The Odin Project 2: Git & GitHub Engineering Workflows, and ship to production.AAA Contrast Verified[Course Outline](/course/odin-git-and-github-workflows)

## The Odin Project 2: Git & GitHub Engineering Workflows

2/21

### Core Architecture & Implementation

- [1.1Git Internals: Blobs, Trees, Commit Snapshots & the Staging Index](/course/odin-git-and-github-workflows/lesson/git-internals-commits-trees-and-staging-area)
- [1.2Branching, Merge Commits vs. Interactive Rebase & Conflict Resolution▶](/course/odin-git-and-github-workflows/lesson/branching-merging-and-rebasing-without-fear)

@CodingCatDev on YouTube62.5K / 100K

Subscribe for new course lessons and architecture deep dives every week.

[Subscribe for New Lessons →](https://www.youtube.com/@codingcatdev?sub_confirmation=1)