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 b59a8c2..2fae0b2 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 * 2fae0b2 2013-04-13 | Updated Rakefile (HEAD, master, greet) [Jim Weirich] * 1c23048 2013-04-13 | Hello uses Greeter [Jim Weirich] * 62d7ce0 2013-04-13 | Added greeter class [Jim Weirich] * b59a8c2 2013-04-13 | Added README [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]
The greet and master branches are now identical.