Git Commands 101: Fetch & Merge

This Git Commands 101 Series explains general Git commands, what they do and how to execute them. Then, we’ll show you how much easier Git commands can be with Cycligent Git Tool (now in beta). Sign up to participate in the beta here. Cycligent Git Tool is useful for newbies and Git Gurus!

Fetch

Command Description: Non-Destructive

Fetch safely imports commits from a remote repo and stores it on a remote branch. This allows you to review your work before you merge into your project with a git merge.

With Cycligent Git Tool

With Cycligent Git Tool’s config options (image below), you have a better way to manage how you fetch your work, giving you peace of mind every time you open your projects. The green information box clearly shows your fetch status.

Git Advanced Options

https://git-scm.com/docs/git-fetch

Typical Usage:

$ git fetch origin

Merge

Command Description: Non-Destructive

What it does: It will merge the changes from one branch into another.

The Hard Way

Okay, so now you want to take a branch and merge it to another branch; typically your master branch. In the examples below, there are two types: a fast-forward merge and a three-way merge. When the branch is linear it merges the histories together and is called the fast-forward merge. When the master branch has been updated and has diverged from the branch it will create a new commit and bring them together.

With Cycligent Git Tool

Cycligent makes it visibly clear what branch you’re working on and the files that you have associated. Merging one branch to another is just as obvious.

Git Advanced Options

https://git-scm.com/docs/git-merge

Typical Usage

$ git merge -s new old

You can sign up to participate in our first private beta here:www.cycligent.com/git-tool. Cycligent Git Tool is free; it is designed to showcase Improvement Interactive’s software development capabilities and our cloud offerings.