Once in a while, I clone a project just to check out the code, have it compiled or even to request a pull for an update.
But what if my clone gets stale? What if it is several commits behind the original repository? You see a message like this:
How do you fix it? Is there a hidden button somewhere in the GitHub portal?
No there is not.
But there are two solutions…
The first is a quick and dirty one. Just delete your own repository and everything in it. Then clone is again 🙂 This is ok for the code but you will also lose all issues, discussions, releases, etc. on your own repository.
The second solution is a better and still simple solution. Just use the command line, you need to be able to execute the GIT command on your command line.
In this example, I forked the https://github.com/Azure/iotedge to my own repository.
Here is how I pulled all new and changed and deleted files from the original repository:
— No iotedge folder is available yet
git remote add upstream https://github.com/Azure/iotedge.git
git fetch upstream
git pull upstream master
Note: c:\git is my main folder with all possible projects
And this is what the portal shows after a refresh.
You can delete the c:\git\iotedge folder afterwards if needed.
This little trick fixes your stale fork. Now you can enjoy all new goodies from the master.