Frank Perez

Frank Perez

Keep in touch

An experienced Web Developer with years of experience in design, programming and server administration.

Blog

Overview

© 2018 by Frank Perez.

Git - Tracking a Remote Branch For Changes

Sometimes you need to track a remote branch for changes, typically called upstream. Let's say you're working on a team where you fork a project and have your own repo. Prior to creating any pull request you'd definitely want to pull in any changes from the originating repository.

To do this git allows you to configure remote repositories, as follows.

Setting up a remote upstream repo so that you can sync it with your forked repo.

git remote add upstream https://github.com/USERNAME/ORIGINAL_REPO_NAME.git

You'd change the above USERNAME with the repo's username, and the ORIGINAL_REPO_NAME with the original repo's name within the URL.

Once you've setup the repo you can confirm that it is configured by using the following command.

git remote -v

This will output a list of all remotely tracked repo's (both for fetching changes and pushing changes)