forked from martamyszki/git-dev-warsztaty-presentation
-
Notifications
You must be signed in to change notification settings - Fork 32
/
rebase-vs-merge.txt
14 lines (9 loc) · 1.76 KB
/
rebase-vs-merge.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Rebase vs. Merge
Now that you’ve seen rebasing and merging in action, you may be wondering which one is better. Before we can answer this, let’s step back a bit and talk about what history means.
One point of view on this is that your repository’s commit history is a record of what actually happened. It’s a historical document, valuable in its own right, and shouldn’t be tampered with. From this angle, changing the commit history is almost blasphemous; you’re lying about what actually transpired. So what if there was a messy series of merge commits? That’s how it happened, and the repository should preserve that for posterity.
The opposing point of view is that the commit history is the story of how your project was made. You wouldn’t publish the first draft of a book, and the manual for how to maintain your software deserves careful editing. This is the camp that uses tools like rebase and filter-branch to tell the story in the way that’s best for future readers.
Now, to the question of whether merging or rebasing is better: hopefully you’ll see that it’s not that simple. Git is a powerful tool, and allows you to do many things to and with your history, but every team and every project is different. Now that you know how both of these things work, it’s up to you to decide which one is best for your particular situation.
In general the way to get the best of both worlds is to rebase local changes you’ve made but haven’t shared yet before you push them in order to clean up your story, but never rebase anything you’ve pushed somewhere.
From: https://git-scm.com/book/en/v2/Git-Branching-Rebasing
What are some difficulties with rebasing, what to be carfull with:
https://medium.com/@fredrikmorken/why-you-should-stop-using-git-rebase-5552bee4fed1