You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/book/03-git-branching/chapter3.asc
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -777,6 +777,26 @@ But if you do, tell everyone who's working on that branch to `git pull --rebase`
777
777
778
778
==== Rebase vs. Merge
779
779
780
+
Now that you've seen rebasing and merging in action, you may be wondering which one is better.
781
+
Before we can answer this, let's step back a bit and talk about what history means.
782
+
783
+
One point of view on this is that your repository's commit history is a record of what actually happened.
784
+
It's a historical document, valuable in its own right, and shouldn't be tampered with.
785
+
From this angle, changing the commit history is almost blasphemous; you're _lying_ about what actually transpired.
786
+
So what if there was a messy series of merge commits?
787
+
That's how it happened, and the repository should preserve that for posterity.
788
+
789
+
The opposing point of view is that the commit history is the story of how your project was made.
790
+
You wouldn't publish the first draft of a book, and the manual for how to maintain your software deserves careful editing.
791
+
This is the camp that uses tools like rebase and filter-branch when they are appropriate for telling the story in the way that's best for future readers.
792
+
If that requires a force-push every now and then, so be it.
793
+
794
+
Now back to the question of which is better.
795
+
Hopefully you'll see that it's not that simple.
796
+
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.
797
+
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.
798
+
780
799
=== Summary
781
800
782
801
We’ve covered basic branching and merging in Git. You should feel comfortable creating and switching to new branches, switching between branches and merging local branches together. You should also be able to share your branches by pushing them to a shared server, working with others on shared branches and rebasing your branches before they are shared.
802
+
Next, we'll cover what you'll need to run your own Git repository-hosting server.
0 commit comments