git merge vs rebase
Merge and rebase both bring your branch up to date with main. This short shows what each one does to the history, and when you should not rebase.
- Vertical 9:16
- Midnight look
Transcript
Your branch is behind main. You can merge it, or you can rebase it.
A merge adds one new commit that joins the two histories.
A rebase takes your commits off your branch and adds them again on top of main, one after the other.
These are new commits, so they get new hashes.
So don’t rebase a branch that other people have already pulled. Their copy still has the old commits.
A merge keeps the history the way it happened. A rebase turns it into a straight line, which is easier to read.
More from technology
Related guides
How to Make Coding Tutorial Videos
A coding tutorial video should help viewers understand a goal, follow the code change, and confirm that the program works.
4 min read Video sizes and formatsVertical Video: When to Use 9:16 and How to Design for It
If you’re making a video for people scrolling on a phone, the frame’s shape determines how much of the screen your message fills and what viewers can see.
3 min read Explainer videosWhat Is an Explainer Video?
When words alone make a product, process, or idea hard to explain, an explainer video can show how it works as a narrator describes it.
4 min read