Rebase Like a Pro: Laravel Ahmedabad Talk Recap

Introduction

Git is one of the most powerful tools in a developer’s toolkit — and while we all use it, few of us use it to its full potential. In my talk at the Laravel Ahmedabad meetup, I dived deep into one of Git’s most underrated and misunderstood features: rebase.

In this blog post, I’ll summarize the key points from my talk, share practical tips, and link to the slides for those who missed it.

Why Learn git rebase?

Many developers stick to git merge because it’s safer and easier to understand. But learning how to rebase can help you:

  • Keep your commit history clean and linear.
  • Avoid unnecessary merge commits.
  • Make code review easier for your team.
  • Squash and reword commits before pushing to main branches.

Understanding the Basics

Merge vs Rebase

  • Merge: Combines two branches, preserving both histories.
  • Rebase: Rewrites your commits to apply them on top of another base commit.
1# Typical use
2git rebase main

This moves your feature branch commits to be "on top of" the latest main.

Live Demo Highlights

Here’s what we walked through in the session:

  1. Rebase a Feature Branch
1git checkout feature-xyz
2git fetch origin
3git rebase origin/main
  1. Squash Commits Before Merging
1git rebase -i HEAD~3

Pick, squash, and reword commits interactively.

  1. Abort a Rebase
1git rebase --abort
  1. Continue Rebase After Conflict Resolution
1# Resolve conflicts
2git add .
3git rebase --continue

Rebase in Pull Requests

Here’s a great workflow to keep your PRs clean:

1git checkout feature-abc
2git fetch origin
3git rebase origin/main
4git push --force-with-lease

Note: Use --force-with-lease instead of --force to avoid overwriting others’ changes on shared branches.

When NOT to Rebase

Never rebase shared or public branches that others are working on.

Rebase rewrites history. Do it only on local branches or branches you control.

Slides from the Talk

You can view or download the slides here: Rebase Like a Pro: Slide Deck (Livewire app)

Wrap Up

Rebasing is a superpower once you master it. It’s cleaner, smarter, and can seriously improve your Git hygiene. especially in collaborative Laravel projects.

Have any questions or want to dive deeper into Git workflows? Drop me a message on Twitter or GitHub!

Tools Mentioned

  • Git CLI
  • GitLens (VS Code Extension)
  • GitHub / GitLab UI for rebase & squash