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 099ccd0..ff7c118
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
* ff7c118 2019-11-01 | Updated Rakefile (HEAD -> master, greet) [Jim Weirich]
* 2a262be 2019-11-01 | Hello uses Greeter [Jim Weirich]
* 413c34f 2019-11-01 | Added greeter class [Jim Weirich]
* 099ccd0 2019-11-01 | Added README [Jim Weirich]
* ed35144 2019-11-01 | Added a Rakefile. [Jim Weirich]
* 4421854 2019-11-01 | Moved hello.rb to lib [Jim Weirich]
* 185fc95 2019-11-01 | Add an author/email comment [Jim Weirich]
* 4d578d4 2019-11-01 | Added a comment (tag: v1) [Jim Weirich]
* dc1d42f 2019-11-01 | Added a default value (tag: v1-beta) [Jim Weirich]
* 9a1c494 2019-11-01 | Using ARGV [Jim Weirich]
* 063b40e 2019-11-01 | First Commit [Jim Weirich]

The greet and master branches are now identical.