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 5c40874..c46c56e
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
* c46c56e 2018-09-28 | Updated Rakefile (HEAD -> master, greet) [Jim Weirich]
* 0ccac93 2018-09-28 | Hello uses Greeter [Jim Weirich]
* a5ff572 2018-09-28 | Added greeter class [Jim Weirich]
* 5c40874 2018-09-28 | Added README [Jim Weirich]
* 191f0c6 2018-09-28 | Added a Rakefile. [Jim Weirich]
* ef98cae 2018-09-28 | Moved hello.rb to lib [Jim Weirich]
* e1e08fd 2018-09-28 | Add an author/email comment [Jim Weirich]
* 7bf0bf1 2018-09-28 | Added a comment (tag: v1) [Jim Weirich]
* 9cf3f21 2018-09-28 | Added a default value (tag: v1-beta) [Jim Weirich]
* 94e1b8b 2018-09-28 | Using ARGV [Jim Weirich]
* f656098 2018-09-28 | First Commit [Jim Weirich]

The greet and master branches are now identical.