You've successfully subscribed to MyPad Blog
Great! Next, complete checkout for full access to MyPad Blog
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Sync git fork branches with upstream repo

Sync git fork branches with upstream repo

One of my projects is synced up to a Git repo as a fork. For the basic structure, I use the root repo that has the base template of my meteor projects which I fork to build custom solutions.

And I've been experimenting with changing the structure of the root repo in various branches and was successful in creating a base template in a different branch.

Now I had this problem of ensuring that the branches of my forked repo is in sync with the root repo.

After a bit of searching, as mentioned here, I was able to find that upstream upstream repository to the root repo, and then do a git fetch, and I was able to sync up the child repo branches to match that of the root repo.

My commands include:

# existing structure
git remote -v

# add upstream
git remote add upstream

# revised
git remote -v

# fetch the branches from the upstream repo
git fetch upstream

Now, I have my new branches to work off from!

Next, I committed the changes from my root repo branch to my current repo branch using SmartGit. All changes were incorporated and I have my modified repo to work off from!