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?
Asked
Active
Viewed 1.4k times
15
-
Possible duplicate of [How do I update a GitHub forked repository?](https://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository) – Ciro Santilli OurBigBook.com Jun 16 '18 at 21:44
1 Answers
35
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

Sajib Khan
- 22,878
- 9
- 63
- 73
-
-
@eastwater to sync the tags: `git fetch upstream --tags; git push origin --tags` – Sajib Khan May 16 '22 at 21:42
-
-
if you want to push only one tag then try this: `$ git push origin refs/tags/
` – Sajib Khan May 17 '22 at 13:40