Hey guys, how are you?!
I hope you are well!
Today I'd like to share a simple and quick article that can help you in many cases!
If you are a person passionate about contributing to community projects, this article may help you with a question!
How to update the forked project repository?!
When we have open source repositories that we fork to make our contributions, we always need to keep them updated!
Because every moment there may be an update from someone else and as a result, our local repository forked on our GitHub will not be updated according to the original repository!
Now, let's do it!
🎯 How to Update:
Let's see how to do this with the steps below:
- ✏️ Step 1: Add the remote origin and call it “upstream”:
git remote add upstream https://github.com/forem/forem.git
You will link the original repository that you forked to your GitHub!
- ✏️ Step 2: Fetch all branches of remote upstream:
git fetch upstream
- ✏️ Step 3: Rewrite your master branch with upstream’s master using the command git rebase:
git rebase upstream/master
- ✏️ Step 4: Push your updates to the branch master:
git push origin master
You may need to use “--force” to do the push, like:
git push origin master --force
This is all personal!
It's quick and easy to update our forked repository!
And with that we can always keep it in accordance with the original and work peacefully!
I hope you liked it and If you have any suggestions, please leave them in the comment.
If you found this post helpful, please like and share it, please!
Happy Coding, See you soon 🤟🏽🤟🏽