Skip to content

lab 35 Merging Back to Master

Goals

Merge greet into master

Execute:

git checkout master
git merge greet

Output:

$ git checkout master
Switched to branch 'master'
$
$ git merge greet
Updating 32cb785..d9d52f1
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

Execute:

git hist

Output:

$ git hist
* d9d52f1 2020-05-30 | Updated Rakefile (HEAD -> master, greet) [Jim Weirich]
* 7226fee 2020-05-30 | Hello uses Greeter [Jim Weirich]
* bd0e5fa 2020-05-30 | Added greeter class [Jim Weirich]
* 32cb785 2020-05-30 | Added README [Jim Weirich]
* 128a484 2020-05-30 | Added a Rakefile. [Jim Weirich]
* a3cf03d 2020-05-30 | Moved hello.rb to lib [Jim Weirich]
* 96c1fec 2020-05-30 | Add an author/email comment [Jim Weirich]
* 9811d9e 2020-05-30 | Added a comment (tag: v1) [Jim Weirich]
* 3344f03 2020-05-30 | Added a default value (tag: v1-beta) [Jim Weirich]
* 3cb4c15 2020-05-30 | Using ARGV [Jim Weirich]
* dfb5614 2020-05-30 | First Commit [Jim Weirich]

The greet and master branches are now identical.