Git how to pull a remote branch

To pull from a remote branch, you first need to fetch the content of that branch. Then you can pull the content.

Run the following command:


	git fetch BRANCH_NAME

	git pull

Here is an example showing the remote branch calling remote -v. Then it fetches the branch and runs a pull on the content:

The output will be:


$ git remote -v
origin  ssh://username@SERVER:/opt/repositories/hosting/oliviertech.com.git (fetch)
origin  ssh://username@SERVER:/opt/repositories/hosting/oliviertech.com.git (push)

Olivier@jupiter MINGW64 oliviertech.com (master)

$  git fetch origin
username@SERVER's password:

Olivier@jupiter MINGW64 oliviertech.com (master)
$ git pull
username@SERVER's password:
Already up-to-date.

References:

Git

Share this article:

Recent Comments