Learning to work on PRs

Working on a PR today I learned some tricks:

// dbu
git pull --rebase
// lsmith
git remote update
git checkout -b feature/myAssertFix_clean upstream/doctrine_dbal
git merge --no-commit --no-ff feature/myAssertFix
git commit -a -m "commit message explaining your changes"
git push origin feature/myAssertFix_clean
git branch --set-upstream feature/myAssertFix origin/feature/myAssertFix
git push origin feature/myAssertFix_clean

Some explanation of the commands above:

1. makes sure local is aware of all the remote changes
2. creates a new local repository based on the state of the upstream repository
3. moves all the code changes from your old local branch to the new one without committing them
4. commits the changes as one commit in the new local branch
5. pushes your new local branch to your repository on github

Special thanks to dbu and lsmith.

We should also remember our two friends:

git rebase -i SHA1
git merge-base branch1 branch2

Leave a Reply

Your email address will not be published. Required fields are marked *