Reputation: 8655
I cloned someones github repo, checked out a new branch to isolate changes I was about to make. having modified the code base significantly I realized I should have instead forked the repo and then send out pull request with my changes.
How can I swiftly recover from that as if I were forking the repo from the start?
Upvotes: 4
Views: 1616
Reputation: 124648
Fork the repo. This will create a clone on GitHub at your user account.
Change the URL of origin
to your fork's URL (instead of the original repo):
git remote set-url origin <fork_url>
Push to origin (your fork), visit your fork's page on GitHub, and there should be a link to compare branches and create Pull Request.
Upvotes: 9
Reputation: 3895
You can add another remote (usually called upstream) to the source repo. This way there will be a link to original repo, and a few git clients (such as Source code or Git Kraken) can show you progress on original project.
Using this you can also pull changes from original project and push to it, and thus creating a pull request in the process.
Adding a remote is easy:
git remote add upstream <git_url>
Upvotes: 0