Skip to content

lab 33 Merging Back to Main

Goals

Merge greet into main

Execute:

git checkout main
git merge greet

Output:

$ git checkout main
Switched to branch 'main'
$
$ git merge greet
Updating 3aa3064..c6d9ed3
Fast-forward
 lib/greeter.js | 11 +++++++++++
 lib/hello.js   |  6 ++++--
 package.json   |  2 +-
 3 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 lib/greeter.js

Because the head of main 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
* c6d9ed3 2019-06-27 | Updated package (HEAD -> main, greet) [Halle Bot]
* 56af19d 2019-06-27 | Hello uses Greeter [Halle Bot]
* 1e7679d 2019-06-27 | Added greeter class [Halle Bot]
* 3aa3064 2019-06-27 | Added README [Halle Bot]
* 2b04803 2019-06-27 | Added a package.json. [Halle Bot]
* b65b430 2019-06-27 | Moved hello.js to lib [Halle Bot]
* 4535421 2019-06-27 | Add an author/email comment [Halle Bot]
* 59992ce 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]

The greet and main branches are now identical.