For open source projects, it's important to keep the history tree as clean as possible. A clean history tree will facilitate an eventual rollback. Having an easy way to rollback PR means that you can accept more PR.
- fork the project https://github.com/deployd/deployd/fork
- Define upstream as new remote
git remote add upstream [email protected]:deployd/deployd.git - create a new branch
git checkout -b feature - add your changes
- add tests
- commit (multiple times if necessary)
git add . && git commit -m "Fix: ..." - make sure that the tests are working
- squash all your commits into one
git merge --squash feature - push your commits
- Make sure you're in sync with upstream
git pull --rebase upstream $branch - create a pull request on github
- Add new commits in response to comments
- Squash your commits into one
git merge --squash feature
- Fetch from upstream
git fetch upstream pull/$PR/head:$BRANCH - Checkout the branch
git checkout $BRANCH - Rebase ```git rebase origin/master````
- If the PR contains multiple commits, squash them
git rebase --interactive HEAD~2(2 being the number of commits to squash) - Change the commits to squash
pick b76d157 b pick a931ac7 cintopick b76d157 b a a931ac7 c - run the tests
- Push the commits
git push upstream $BRANCH:master - Close the PR with the message
landed as $COMMIT_SHA