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 cad8e98..8db103d 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 * 8db103d 2013-10-06 | Updated Rakefile (HEAD, master, greet) [Ismail Dhorat] * 30ae4be 2013-10-06 | Hello uses Greeter [Ismail Dhorat] * 8da6cc5 2013-10-06 | Added greeter class [Ismail Dhorat] * cad8e98 2013-10-06 | Added README [Ismail Dhorat] * 27b8b27 2013-10-06 | Added a Rakefile. [Ismail Dhorat] * 23944f0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat] * 273edac 2013-10-06 | Add an author/email comment [Ismail Dhorat] * 9efd33e 2013-10-06 | Added a comment (v1) [Ismail Dhorat] * 8b9a1c6 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat] * f6f4d6b 2013-10-06 | Using ARGV [Ismail Dhorat] * f98d857 2013-10-06 | First Commit [Ismail Dhorat]
The greet and master branches are now identical.