At times there is a need to update your forked repository with the recent commits which happened on the main repository, and to update it we generally use git bash & console but what if I tell you that there is a very simple way of doing this?
Most of you who are an avid git and github user might already know about this small trick but those who don't know about this or want to learn about it do give it a read 👉
Step-1 : Go to your forked repository on GitHub.
Step-2 : Now you must be seeing a white label like this saying - 'this branch is behind commits' with a 'pull requests' button. Click on that "Pull request" button on the right.
Step-3 : Now you must be seeing a page saying 'There isn't anything to compare' this happens because what GitHub does is, it compares your repository (head fork) with the main repository (base fork) and as you have not made any commits or changes therefore it shows nothing.
But now you can also see 'switching the base' link. So click on “switching the base” link.
Now what it will do is, it will switch both the things that are, change your fork to the base, and the original to the head fork.
Step-4 : After applying the above steps now you will observe that there are a lot of commits and changes. You can also see that the "Create Pull request" button is active . Click on “Create Pull Request” button, give your pull request a name, Click “Send Pull Request”. You have successfully sent a PR to your own forked repository.
Step-5 : Now in your forked repository you will spot a pull request. Click “Merge Pull Request” and Click “Confirm Merge”.
So there you have it the easiest way to update/sync your forked repository directly on GitHub by just sending a pull request. I hope you learnt something from this today.