After a PR is ready to merge you should:
- Pull in other people's commits
- Rebase your commit on top of theirs
- Squash your commits into a final commit
- Force push your commit to origin
- Pull upstream commits from staging and rebase so that the final commit comes after them.
git checkout feature/branch-name
git pull --rebase origin staging
-
Resolve conflicts
- Edit files with conflicts.
- Accept incoming, current, or both.
code (or atom, sublime, etc) file.ts
- After resolving conflicts, stage files.
- Then continue rebase.
git add file.ts git rebase --continue
-
Create a final squash commit
- Specify commit id BEFORE the oldest commit to include
- In editor change all picks to s, except first one
- Consoliate commit messages
git rebase -i <commit_id>
- Force push feature branch to remote
git push --force
- After the PR is merged, delete local feature branch and pull latest from origin