lab 28 Merging

Goals

Merge the branches 01

Merging brings the changes in two branches together. Let’s go back to the greet branch and merge master onto greet.

Execute:

git checkout greet
git merge master
git hist --all

Output:

$ git checkout greet
Switched to branch 'greet'
$ git merge master
Merge made by recursive.
 README |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 README
$ git hist --all
*   844d1ed 2013-04-13 | Merge branch 'master' into greet (HEAD, greet) [Jim Weirich]
|\  
| * b59a8c2 2013-04-13 | Added README (master) [Jim Weirich]
* | 28917a4 2013-04-13 | Updated Rakefile [Jim Weirich]
* | 4dac415 2013-04-13 | Hello uses Greeter [Jim Weirich]
* | 39347b3 2013-04-13 | Added greeter class [Jim Weirich]
|/  
* 96ee164 2013-04-13 | Added a Rakefile. [Jim Weirich]
* 0f36766 2013-04-13 | Moved hello.rb to lib [Jim Weirich]
* eb30103 2013-04-13 | Add an author/email comment [Jim Weirich]
* 1f7ec5e 2013-04-13 | Added a comment (v1) [Jim Weirich]
* 582495a 2013-04-13 | Added a default value (v1-beta) [Jim Weirich]
* 323e28d 2013-04-13 | Using ARGV [Jim Weirich]
* 9416416 2013-04-13 | First Commit [Jim Weirich]

By merging master into your greet branch periodically, you can pick up any changes to master and keep your changes in greet compatible with changes in the mainline.

However, it does produce ugly commit graphs. Later we will look at the option of rebasing rather than merging.

Up Next 02

But first, what if the changes in master conflict with the changes in greet?

Table of Contents