Keeping your bitbucket repo in sync with upstream

I imported the NuttX repository to my bitbucket account with name nuttx_nyx (for NyX board). Then I want to keep it in sync with mainline/upstream without accessing the bitbucket page to click on “Sync” button.

So you just need to add the upstream remote:

$ git remote add upstream https://bitbucket.org/nuttx/nuttx

Then we have two remotes now:

$ git remote -v

origin	https://bitbucket.org/acassis/nuttx_nyx (fetch)
origin	https://bitbucket.org/acassis/nuttx_nyx (push)

upstream	https://bitbucket.org/nuttx/nuttx (fetch)
upstream	https://bitbucket.org/nuttx/nuttx (push)

Then when you fetch from upstream it will be putted on you origin/master:

$ git fetch upstream
From https://bitbucket.org/nuttx/nuttx
   afe137f..fe7d8c9  master     -> origin/master

Fine, now just do the default way:

$ git push origin master

You can create your local commit and rebase it with be on top of upstream and saved to your repository.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s