Skip to content

lab 39 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 62f7394..62eac9b
Fast-forward
 Rakefile       | 2 +-
 lib/greeter.rb | 8 ++++++++
 lib/hello.rb   | 9 +++++----
 3 files changed, 14 insertions(+), 5 deletions(-)
 create mode 100644 lib/greeter.rb

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
* 62eac9b 2022-10-24 | Updated Rakefile (HEAD -> main, greet) [Jim Weirich]
* 7a0c973 2022-10-24 | Hello uses Greeter [Jim Weirich]
* 5729241 2022-10-24 | Added greeter class [Jim Weirich]
* 62f7394 2022-10-24 | Added README [Jim Weirich]
* 0022837 2022-10-24 | Added a Rakefile. [Jim Weirich]
* 3172288 2022-10-24 | Moved hello.rb to lib [Jim Weirich]
* 3e56dbf 2022-10-24 | Add an author/email comment [Jim Weirich]
* 1dee7f9 2022-10-24 | Tell user how many names they have (tag: v1) [Jim Weirich]
* c72af6b 2022-10-24 | Rename variable to match its usage (tag: v1-beta) [Jim Weirich]
* 8cdd2cd 2022-10-24 | Can specify multiple names [Jim Weirich]
* 28fe396 2022-10-24 | Added a comment [Jim Weirich]
* 15c7573 2022-10-24 | Added a default value [Jim Weirich]
* 7d55044 2022-10-24 | Using ARGV [Jim Weirich]
* 91b926e 2022-10-24 | First Commit [Jim Weirich]

The greet and main branches are now identical.