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 the 'recursive' strategy.
 README | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 README
$ git hist --all
*   4ce379e 2013-10-06 | Merge branch 'master' into greet (HEAD, greet) [Ismail Dhorat]
|\  
| * 313c04d 2013-10-06 | Added README (master) [Ismail Dhorat]
* | 7a5c511 2013-10-06 | Updated Rakefile [Ismail Dhorat]
* | 815cf27 2013-10-06 | Hello uses Greeter [Ismail Dhorat]
* | 209ff42 2013-10-06 | Added greeter class [Ismail Dhorat]
|/  
* b3e19a3 2013-10-06 | Added a Rakefile. [Ismail Dhorat]
* 14f09c0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat]
* 1fed2ec 2013-10-06 | Add an author/email comment [Ismail Dhorat]
* dc44f2e 2013-10-06 | Added a comment (v1) [Ismail Dhorat]
* 5ec54fd 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat]
* e606a20 2013-10-06 | Using ARGV [Ismail Dhorat]
* 5d95e74 2013-10-06 | First Commit [Ismail Dhorat]

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