- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I update forked repository on GitHub?
Hi
I forked a project, applied several fixes and created a pull request which was accepted. A few days later, another change was made by another contributor. So my fork doesn't contain that change.
How can I get that change into my fork? Do I need to delete and re-create my fork when I have further changes to contribute? Or is there an update button?
โ02-14-2022 04:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The "tabula rasa" method.
Keep around the SHA of the "one commit" (or two, three, ...) which are your code and you'd like to submit to the original repo: go to your branch, do a git log and find it / keep it copied somewhere.
find the git url for the original upstream codebase; the one you forked from, not your github clone. say it's git://git.github.com/foo/bar
git remote add upstream git://git.github.com/foo/bar
git fetch
git checkout master
git reset --hard upstream/master (this makes local "master" be same as upstream's master)
git checkout -b your-snazzy-branch-name
git cherry-pick SHA_OF_YOUR_COMMITS
git push origin your-snazzy-branch-name
open a pull request for your-snazzy-branch-name
โ02-14-2022 08:45 PM

