Update a Severely Out of Date GitHub Repository Fork

Recently, I received notification from Planet PowerShell that they will be removing blogs that do not support HTTPS as of August 1st. I had forked their repo on GitHub over a year ago, added my blog, and submitted a pull request. I hadn’t touched my fork of their repo since then. It was severely out of date and in an unknown state.

Taking a look at it on my system showed my local copy only had one remote which was my fork on GitHub.

I could see that one of the files had been updated in my local copy, but not committed. I didn’t have a clue about what changes had been made or why they were made.

The git diff command can be used to show what’s been changed as shown in the following example.

I don’t care about those changes. I’ll simply check that file out again to discard those changes.

Now I’ll add the upstream remote and fetch any updates, or a copy of it in this scenario.

All that needs to be done now is to merge the changes from upstream into my current branch.

I know why they call this a GitHub fork. Stick a fork in it, this repo is done!

That was wishful thinking. While the previous command would work in many cases, this repo is too far out of date. I could simply delete my local copy and my forked copy of it on GitHub and then fork it again along with cloning it locally again. That’s a lot of trouble and work. I’ll simple do a hard reset on my local copy and then force those changes into my forked copy on GitHub.

Warning: Use the following commands at your own risk!

Per the Git documentation, the following command “Resets the index and working tree. Any changes to tracked files in the working tree are discarded”. You will loose any changes you’ve made using these commands.

Make sure you understand what is happening before proceeding.

My local copy and my forked copy on GitHub are now in sync with the Planet PowerShell repo on GitHub.

Now I can make the necessary changes to my profile file to direct readers on Planet PowerShell to my blog site via HTTPS instead of HTTP and everyone will be happy!

µ

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: