Merging Back to Master
Goals
- We’ve kept our greet branch up to date with master (via rebase), now let’s merge the greet changes back into the master branch.
Merge greet into master
Execute:
git checkout master
git merge greet
Output:
$ git checkout master
Switched to branch 'master'
$
$ git merge greet
Updating 8d90176..e0cc19e
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
* e0cc19e 2020-06-20 | Updated Rakefile (HEAD -> master, greet) [Jim Weirich]
* 046088a 2020-06-20 | Hello uses Greeter [Jim Weirich]
* 3db0ffe 2020-06-20 | Added greeter class [Jim Weirich]
* 8d90176 2020-06-20 | Added README [Jim Weirich]
* 5aec14d 2020-06-20 | Added a Rakefile. [Jim Weirich]
* 721b979 2020-06-20 | Moved hello.rb to lib [Jim Weirich]
* 907a445 2020-06-20 | Add an author/email comment [Jim Weirich]
* 4254c94 2020-06-20 | Added a comment (tag: v1) [Jim Weirich]
* c8b3af1 2020-06-20 | Added a default value (tag: v1-beta) [Jim Weirich]
* 30c2cd4 2020-06-20 | Using ARGV [Jim Weirich]
* 4445720 2020-06-20 | First Commit [Jim Weirich]
The greet and master branches are now identical.
当前内容版权归 gitimmersion 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 gitimmersion .