Update your fork repo from it’s Upstream

#case: you fork a repo from github into your account, and upstream (owner) of repo have an update and you want to sync it to your fork repo

 

sample:

— you fork my repo: https://github.com/addhe/Akubot then it will copied over to your github account let’s called your github account ‘mrsomething’ Akubot repo will be copy and now it become https://github.com/mrsomething/Akubot.git

— you now able to git clone Akubot thru your github account, you will be able to push, commit and so forth.

— in the future i have update to Akubot and it’s important, you want to update your Akubot and do not want to destroy or remove your custom changes. let’s do this

 

  1. cd Akubot
  2. check upstream, change the upstrem to my repo
    “`
    git remote add upstream https://github.com/addhe/Akubot.git
    “`
  3. check git remote
    “`
    git remote -v
    “`
  4. fetch upstream update
    “`
    git fetch upstream
    “`
  5. Check out to your local master repo, this will change to master branch
    “`
    git checkout master
    “`
  6. Merge Upstream update to your local repo
    “`
    git merge upstream/master
    “`
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s