How to download and merge commits from a remote branch on your local branch – 118

Today’s tip shows how to combine doing a Fetch and a Merge by using the Pull command.

Suppose you have some incoming commits that you’re ready to merge into your local branch. In this example, I’ve create a new file on master on GitHub and I want to bring that commit into my local master branch.

Instead of fetching to review the commits that are going to be applied, we’ll assume you’ve already looked at GitHub to see what will be merged in.

Pull incoming commits into local master branch

The result of the Pull command shows a message at the top of the Team Explorer.

Repository updated to commit ID

Viewing the history on the master branch shows the tip (the top of the branch) having the newly merged in commit from GitHub.

History for local master branch

This begs the question: Why use Fetch? Why not always do a Pull? I believe the answer is

    1. if you want to verify what commits have been downloaded
    2. if you want to know if you’ll run into any merge conflicts before doing the Pull (the merge portion of Pull). However, I’m not sure how you can know if you’re going to have any merge conflicts, if you haven’t first merged the commits somewhere. I guess you could manually review the changes. Perhaps someone reading this knows what I’m missing.

One thought on “How to download and merge commits from a remote branch on your local branch – 118

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s