this post was submitted on 06 Oct 2025
824 points (96.7% liked)
Programmer Humor
26772 readers
1181 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Don't be afraid of rebases, they are an essential tool in Git.
This particular fear can only be addressed by understanding.
I don't understand it. Every time I see something about a rebase it's some purist telling me it's "cleaner". Never got it to do what it says on the tin, and never hit a situation that I couldn't solve using more straightforward tools like merge.
What's your mental model for a Git commit, and a Git branch?
Once I properly learned those two concepts, understanding rebases became a lot easier.
I'll try to explain it to the best of my abilities.
When you rebase a particular branch, what you're essentially doing is taking all of the commits that are currently on your branch, checking out the other branch, and then applying each of the patches in order on that new branch.
A rebase can be cleanly applied if the premise for each commit has not changed when applied, but if the premise has changed, you get a conflict to be resolved before being able to continue the rebase.
I mentally model a rebase a bit as a fast version of how it would look like to build the branch I was on, but on top of the branch I'm rebasing on.