Stop using git pull
✨ Introduction
If you're working in a shared Git repository and using git pull
by default, you're probably bloating your commit history without even realizing it.
Let me show you how this happens, how to fix it, and what to do when even the fix hits a wall.
🚨 The Problem with git pull
When you run:
git pull
Git fetches the latest changes and merges them with your local branch. That sounds harmless — but under the hood, it creates a merge commit, even if no real conflict exists.
Now imagine every developer on your team doing this daily. Before long, your Git history is filled with meaningless "merge commits" that make it hard to trace actual changes.
🧼 The Solution: git pull --rebase
Instead of merging, use:
git pull --rebase
This does three things:
- Temporarily stashes your local commits.
- Pulls in the latest from the remote branch.
- Reapplies your changes on top — creating a clean, linear history.
📊 Git History Comparison
Here's how git pull
vs git pull --rebase
affects your commit tree:

🤯 But What If a Rebase Fails?
Here’s where it gets real.
Even git pull --rebase
isn't immune to problems. If you and someone else change the same part of a file, Git won't know whose changes to keep.
Let’s say your teammate pushes this to main
:
def greet():
print("Hello, JZR!")
Meanwhile, you had this locally:
def greet():
print("Hi, Robert!")
Now you run:
git pull --rebase
Git tries to apply your change on top of theirs… and fails:
CONFLICT (content): Merge conflict in app.py
🛠 What to Do Next
✅ Option A: Resolve the Conflict Manually
Edit the file, resolve the conflict, then:
git add app.js git rebase --continue
🚫 Option B: Abort and Fall back
If it’s too messy or unexpected:
git rebase --abort git pull
This creates a regular merge commit — not ideal, but safe.
💡 Best Practice: Use an Alias
To save time, create an alias for rebase pulls:
git config --global alias.pr "pull --rebase"
Now just run:
git pr
Simple, clean, team-friendly.
📎 Bonus Tips & Nuances
Let’s clarify a few things for those who want to go deeper:
-
git pull
is justgit fetch
+git merge
by default. -
If you’re the only one working on a branch, it’s totally fine to use
git pull
. -
If you squash on merge, rebase becomes less critical.
But for teams without clear branching strategies,git pull --rebase
prevents chaos. -
You can configure Git to rebase by default:
git config --global pull.rebase true
After this,
git pull
will rebase by default, and you can still force a merge withgit pull --merge
. -
In newer versions of Git, you’ll even be asked your preferred pull strategy the first time you use it.
🧠 Summary
git pull
creates merge commits that clutter your history.git pull --rebase
keeps things tidy and linear.- If a conflict occurs, either resolve it or fall back to a merge.
- Use an alias like
git pr
to rebase by default.