Updating a GitHub Fork

Submitted by Steve on Mon, 10/31/2016 - 21:05

I'm using PHPStorm for source maintenance.  One of the steps I want to do on a regular basis is to properly sync my GitHub fork with the original.  I installed the GitHub plugin to PHPStorm but could not find anything that would provide what I wanted to do.   I also installed GitHub Desktop but again was unable to find the magic sequences of events. I suspect it has to be there in GitHub Desktop but the solution wasn't "in my face.

So back to Google where I found the steps listed below (from stackoverflow).  There are always "but firsts" - I had to reinstall Git for Windows (I had to uninstall an older version in order to avoid a version conflict when installing GitHub Desktop).

But after all was in place I accomplished what I wanted to do  with the following steps.

  • Started up PHPStorm and copied the path to the root of my project (which is a local repository of my GitHub fork).
  • Opened up a command prompt
  • Changed the directory to the root of my project
  • Entered the following commands
    • git remote add upstream https://github.com/jekkos/opensourcepos
    • git fetch upstream
    • git checkout master
    • git rebase upstream/master
    • git push -f origin master

After doing the above I logged on to my GitHub fork and checked to see where it stood in relation to the original and found that it was current.

I celebrated with a fine scotch whiskey toasting to my first success - hoping for many more celebrations.

 

 

Tags