So you've cloned a repo and made some changes? Now you want to submit a PR. This'll make it look like you didn't forget to fork before making the changes. Zero loss of face and endless enjoyment.
-
Fork the repo on GitHub.
-
Rename the local remote.
git remote rename origin upstream
-
Add your fork as the new origin.
git remote add origin git@github:...my-fork.git
-
Fetch the fork to update your branches.
git fetch origin
-
Create a new branch with your changes.
git branch changes
-
Checkout your fork's master branch. (This resets the current master branch so changes will be lost.)
git checkout -B master --track origin/master
-
Rebase your changes onto the new master.
git rebase changes
-
Optionally remove your temporary changes branch.
git branch -d changes
-
Push your changes to your fork so you can create a PR on GitHub.
git push
Credit goes to @jagregory for the original this is based on.