14

Explain git rebase to me like I'm five

 3 years ago
source link: https://dev.to/highcenburg/explain-git-rebase-to-me-like-i-m-five-df7
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for Explain git rebase to me like I'm five

Explain git rebase to me like I'm five

Jan 8

・1 min read

Discussion

Subscribe

pic

CollapseExpand

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 :)

Comment button Reply

CollapseExpand

This is very informative. Illustrations provide better understanding. Thanks for sharing. :)

Comment button Reply

CollapseExpand

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.

Comment button Reply

CollapseExpand

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)

Comment button Reply

CollapseExpand

rebase = re-apply the commits on this branch to a different starting point

Comment button Reply


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK