Photo by Sebastian Herrmann on Unsplash
How does this work?
Photo by Sebastian Herrmann on Unsplash
How does this work?
For further actions, you may consider blocking this person and/or reporting abuse
JT Ziolo -
David Paluy -
Okoye Ndidiamaka -
Alexandre Calaça -
Top comments (5)
I'd highly recommend watching How Git Works by Paolo Perrotta on Pluralsight. There's a section on rebasing that I'll link to here, but it's best to watch the whole thing to pick up all of the background that makes this simple to understand: app.pluralsight.com/course-player?...
(A bit of a cop-out response, I know, but I think this course is OUTSTANDING and will do a much better job than me of explaining it)
I love illustrations and pratice so I guess this is a good explanation : learngitbranching.js.org/
You can find how rebase works but other things also :)
Rebasing is a tricky concept to grasp, as well as its consequences.
Lets try this metaphor.
Imagine a heavy metal chain. Each link in the chain is a git commit. Each link knows about the one before it.
Most non-rebase commands work by simply attaching new links to the chain.
Rebase, on the other hand, breaks one of the links, and then rebuilds a brand new chain from that point.
The reason this matters is that when you use git you're sharing the chain. When someone makes a mistake with rebase, you have to solve the problem that someone else threw away that shared chain created a new one and has thrown it at you.
This is why most advice you'll find about rebasing follows a golden rule of you can rebase things that you've not shared/pushed.
Merge:
Mommy branch and daddy branch merge and get a new baby branch.
Rebase:
Einstein gets human branch and robot branch and turns human branch into a cyborg.
rebase = re-apply the commits on this branch to a different starting point