Chapter 9. Three-Way Merges
[ 9 ]
Three-Way Merges
|
In Chapter 8, you learned about cloning and what it’s like to collaborate with another person on a Git project. You walked through an example of a friend contributing work to the Rainbow project, pushing the work to the remote repository, and you fetching and merging the work in order to keep your repositories in sync. All of the merges you have done up until this point in the Rainbow project have been fast-forward merges. In this chapter, you will learn how to carry out a three-way merge. In the process, you will also go over an example of defining upstream branches and you will learn about what happens when you edit files multiple times in your working directory between commits. Finally, you will learn about pulling from a remote repository, and we will discuss how pulling is different from fetching. |
State of the Local and Remote Repositories
At the start of this chapter, you should have two local repositories called rainbow and friend-rainbow and one remote repository called rainbow-remote. All three of these repositories should be in sync; in other words, they should contain the same commits and branches. I recommend that you continue using two separate text editor windows and command line windows for the rainbow repository and the friend-rainbow repository as you work through the examples in this chapter, as discussed in “The Collaboration Simulation” on page 115.
Visualize it 9-1 shows the state of the local ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access