You forked a repository on GitHub, made a bunch of changes and then pushed them to GitHub. Now you want to submit a pull-request to fix a bug you found. However, because your fork is a dozen revisions beyond the original repository you’re certain your pull-request will be rejected.
Create a new branch which copies the current state of the original repository, make your change, and then submit your pull-request.
You always ought to create a separate branch for pull-requests.
Create a remote tracking branch called “upstream” which tracks the master branch of the original repository.
Fetch the latest changes from the branch
Create a new branch for the pull-request called
pr-bug-fix and switch to that
pr-bug-fix to the current state of
pr-bug-fix is synchronized with the current state of the original
repository. As such, you can safely fix the bug submit the pull-request.