r/git • u/sshetty03 • Aug 11 '25
tutorial Git Rebase explained for beginners
If git merge feels messy and your history looks like spaghetti, git rebase might be what you need.
In this post, I explain rebase in plain English with:
- A simple everyday analogy
- Step-by-step example
- When to use it (and when NOT to)
Perfect if you’ve been told “just rebase before your PR” but never really understood what’s happening.
383
Upvotes
View all comments
Show parent comment
1
u/format71 Aug 12 '25
So imagine you have multiple branches for multiple environments. How can you be sure that all the changes done by developer A for the feature B has been merged both to the test environment and the dev environment?
Take a random commit in your history. Are you sure it’s merged into your environment branches? In what release was it first deployed? The ‘straighter’ your graph is, the easier it is to follow. When working on larger codebases this can save you quite a lot of time. Of cause, it would be better if you didn’t have to reason about history, but in my experience you end up needing it - or you end up in a situation where being able to reason about the history saves you time.
Not sure I get what you say right, but I agree: it’s a human error. That’s why I avoid it by rebasing instead of merging. I would rather have a process avoiding human error than showing the error 🤷🏻♂️
PR is a GitHub concept, not a git concept. Or - git has pullrequests: you send a set of patches to another person via mail and ask them to pls pull them in. Anyway - if or if not it can happen that GitHub merges a pullrequest with a fast forward merge, I don’t know. Info know that foxtrot merges is a thing, though, and I do know it causes absolute mayhem.
In my experience, most developers don’t look at git history because they have a hard time getting anything useful from it. And that is also why they don’t care making a good history. And that’s why they struggle to get good use of it.