Tag: merge

How to merge from a remote tracking branch into your local branch in command line – 124

Today’s tip is the continuation from Tip 118 – how to download and merge from a remote branch into Visual Studio, but using the command line.

Let’s suppose you have a local branch that’s tracking the remote branch (see yesterday’s tip). And let’s say someone has made an update to that remote branch (e.g. they made a commit `newfile.md` via the GitHub UI to the branch). Now you want to get those changes into your local branch.

First, we’ll put this week’s earlier tip to good use by doing a `git fetch` just to get those changes onto your computer.

Now you want to merge those changes into your local branch.

First, make sure you’ve checked out the desired branch to receive the merge.

Second, do the merge from the remote tracking branch (since it has the data)

$ git merge origin/<branch-name>

git merge origin/I-am-a-new-branch

And now if you do a `dir` or `ls` you’ll see the changes. In my example, the newfile.md is now shown in the local branch.

newfile.md shown in local branch