syncing a fork from base upstream - Github



If it's been a while since you forked a repository on github , there are very good possibilities that the base repository is now updated and you would like to sync your local repo to the upstream repo.

There are two ways you can do this: the github GUI or the command prompt:

From the UI:


  1. Open the forked git repo forkedRepo
  2. Click on compare 
  3. You will get this notification "There isn't anything to compare baseRepo is up to date with all commits from forkedRepo. Try switching the base for your comparison."
  4. Click on switching the base on this page. 
  5. Then you get to see all the commits made to baseRepo after the day you forked it.
  6. Click on "Click to create a pull request for this comparison"
  7. Give the pull request a title and maybe a description and click send pull request.
  8. On the next page, Scroll to the bottom of the page and click merge pull request and confirm merge.
  9. Your Git repo forkedRepo will be updated!!!
  10. You can smile now :)

From the command prompt:
  1. Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).
  2. Change the current working directory to your local project.
  3. Check out the branch you wish to merge to. Usually, you will merge into master.
    $ git checkout master
  4. Pull the desired branch from the upstream repository. This method will retain the commit history without modification.
    $ git pull https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git BRANCH_NAME
  5. Commit the merge.
  6. Push the merge to your GitHub repository. git push origin master
  7. You can smile now :)

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?