lab 35 Merging Back to Master
Goals
- We’ve kept our greet branch up to date with master (via rebase), now let’s merge the greet changes back into the master branch.
Merge greet into master 01
Execute:
git checkout master git merge greet
Output:
$ git checkout master Switched to branch 'master' $ $ git merge greet Updating 313c04d..d15df76 Fast-forward Rakefile | 2 +- lib/greeter.rb | 8 ++++++++ lib/hello.rb | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 lib/greeter.rb
Because the head of master is a direct ancestor of the head of the greet branch, git is able to do a fast-forward merge. When fast-forwarding, the branch pointer is simply moved forward to point to the same commit as the greeter branch.
There will never be conflicts in a fast-forward merge.
Review the logs 02
Execute:
git hist
Output:
$ git hist * d15df76 2013-10-06 | Updated Rakefile (HEAD, master, greet) [Ismail Dhorat] * 2fda7cb 2013-10-06 | Hello uses Greeter [Ismail Dhorat] * 343d947 2013-10-06 | Added greeter class [Ismail Dhorat] * 313c04d 2013-10-06 | Added README [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]
The greet and master branches are now identical.