Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Tracking Upstream

I am working on a project and I have a central git repo. This project is a skeleton to be a baseline for a number of forks.

Is it possible to configure my local working repository for a fork to track the central for the project as origin and track the skeleton's master as a separate branch named upstream tracking the master of the skeleton to cherry pick changes to the skeleton?

I guess I want my workflow to be something like:

Create Skeleton >> Fork Skeleton >> Skeleton Pulls Changes from Fork 2 >> Fork 1 Pulls Changes from Skeleton

Is there a better process to do what I have described?

like image 549
Steve Buzonas Avatar asked Jun 12 '12 20:06

Steve Buzonas


1 Answers

Read the "Step 3: Configure remotes" of the GitHub "Fork a Repo" page (I know you didn't mention GitHub, but it is still relevant)

  • origin is the remote address of your fork, that your local clone can pull from/push to
  • upstream is the remote address of your original repo Skeleton (you can add it with a git remote add upstream https://..../Skeleton.git)

So upstream isn't a branch.

But you can define a local branch which will have for upstream branch the remote tracking branch master from upstream repo, with git branch:

git branch --set-upstream upstream_master upstream/master

However, you don't need a local branch, especially if you won't ever make new commits on it: you can compare your master with upstream/master directly, after a git fetch upstream, cherry-picking what you need from upstream/master.

like image 183
VonC Avatar answered Sep 28 '22 11:09

VonC