I created the fork of some GitHub project. Then I created new branch and did a patch inside of that branch. I sent the pull request to author and he applied my patch and added some commits later. How can I synchronize my fork on GitHub with original project now? Am I to delete my fork on GitHub and create new fork for each my patch each time?
1 Answer
You don't need to refork
again. Just add a remote (say, upstream
) and fetch upstream
to update your cloned repository.
$ git remote add upstream <original-repo-url>
$ git fetch upstream # update local with upstream
$ git diff HEAD..upstream/master # see diffs between local and upstream/master (if there is no diff then both are in sync)
$ git pull upstream master # pull upstream's master into local branch
$ git push origin HEAD # push to your forked repo's remote branch
Fetch/get the original repo's new tags
:
$ git fetch upstream --tags # get original repo's tags
$ git push origin --tags # push to forked repo
-
-
@eastwater to sync the tags:
git fetch upstream --tags; git push origin --tags
Commented May 16, 2022 at 21:42 -
-
if you want to push only one tag then try this:
$ git push origin refs/tags/<tag-name>
Commented May 17, 2022 at 13:40