Solutions to Git Problems

Git Branch

How do you pull a remote Git branch?

Let’s say your local Git branch is out-of-date, and you need to fetch changes from your remote branch in order to bring your local branch up to speed.

In order to fetch these changes from your remote, or in other words, download the changes to your local branch, you will use the git pull command.

By default, Git will technically perform a git fetch followed by a git merge for the branch that you currently have checked out.

Need a refresher? Get everything you need to know about checking out branches in Git, including how to switch a Git branch locally and how to checkout a remote Git branch.

Let’s see how the git pull command works in the CLI.

If a merge is not required, Git will fast forward your local branch. This means that your local branch will now be pointing to the most recent commit from your remote branch without merging. However, if a fast forward is not possible because a merge is required, a merge will be executed instead.

Learn more about how to merge a Git branch, including how to merge a Git branch with master.

git pull --ff-only

You may choose to pull a branch using only fast forward if you only want non-conflicting changes brought in and never want a merge executed.

Now, if you would prefer to pull a branch only using fast forwarding, you can append the --ff-only flag to the git pull command.

Git Pull Rebase

Alternatively, if you prefer to rebase when combining file changes, you may choose to rebase the commits from the remote Git branch you are pulling, rather than merging them.

You can accomplish this with the --rebase flag.

git pull --rebase

How do you pull a remote branch in GitKraken?

Pulling changes from a remote Git branch is far more simple using the visual assistance of a Git client, like GitKraken.

Follow along with an example
using the GitKraken Git GUI

In this example, we’re going to fetch changes from a remote branch and bring the local branch up to speed.

To fetch changes in GitKraken, simply click the Fetch button in the top toolbar and select one of the Pull options from the dropdown menu. This will fetch the remote for your currently checked out branch and merge the associated changes into your local branch.

You can see there are multiple options to choose from when you want to pull a remote branch in GitKraken.

Pull remote branch

GitKraken allows you to easily choose between performing a Git pull with fast forward, fast forward only, or a Git pull rebase. No need to remember or type any commands!

How do you pull a local branch in GitKraken?

In GitKraken, you can quickly pull any local Git branch by right-clicking the branch from the left panel.

Pull local branch

If you want to pull from a remote Git branch, do yourself a favor and streamline the process with the help of the legendary GitKraken Git GUI.