After forking a repository on GitHub
, You need to make some changes as a contributions, So you starting with make updates, Then commit it, And finally push them and send a Pull Request
, But the problem that the repository maintainer comment on your PR and tell you that your changes are a head.
So what is the problem?
Usually the problem that your copy of the repository is older than the original repository, In another words, Some changes made to the repository after you forked it and you don’t synced it yet.
So all what you need to do is to sync it, and we will use CLI
to make this.
Step.1
Change the directory to your local repository:
cd <repo-name>
Step.2
Add the remote to your repo. and call it upstream
:
git remote add upstream <original-repo-link>
Step.3
Fetch all the remote branches:
git fetch upstream
Step.4
Merge your master or main
with changes:
git merge upstream/master or main
Step.5
Now you can push the updated changes to your remote forked repo:
git push
Make sure that you are on the master or main branch
I hope this be useful folks :)
Have a nice time.
Top comments (0)