git-fork-branch-cheatsheet
My cheat sheet
⚙ Set up
- Fork it
git clone <forked repo>git remote add upstream <original repo>.git
🔃 Workflow
git pull upstream mastergit push origin mastergit checkout -b <branch>- Work. Work. Work.
git push origin <branch>- Create PR
- Wait for it to be merged, then ...
git checkout mastergit pull upstream mastergit branch -d <branch>(or-Dif necessary)git push origin mastergit push --delete origin <branch>git pull upstream mastergit push origin master
🆘 Get out of Jail, Free
(when things go wrong, force fork to sync with upstream)
⚠ WARNING only do this if you do not have pending commits. They will be obliterated!
git fetch upstreamgit reset --hard upstream/mastergit push origin master --force
quod erat demonstrandum