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
*   9d0aceb 2014-10-25 | Merge branch 'master' into greet (HEAD, greet) [Jim Weirich]
|\  
| * 6fd9eff 2014-10-25 | Added README (master) [Jim Weirich]
* | 12414e9 2014-10-25 | Updated Rakefile [Jim Weirich]
* | 43ba308 2014-10-25 | Hello uses Greeter [Jim Weirich]
* | acd8535 2014-10-25 | Added greeter class [Jim Weirich]
|/  
* 14ba469 2014-10-25 | Added a Rakefile. [Jim Weirich]
* 4b249b3 2014-10-25 | Moved hello.rb to lib [Jim Weirich]
* bfd1408 2014-10-25 | Add an author/email comment [Jim Weirich]
* a1189df 2014-10-25 | Added a comment (tag: v1) [Jim Weirich]
* 6083cb8 2014-10-25 | Added a default value (tag: v1-beta) [Jim Weirich]
* b24f3ff 2014-10-25 | Using ARGV [Jim Weirich]
* cf466b4 2014-10-25 | 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