Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Last active June 30, 2017 11:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tonysneed/42263e6577c30063d093aef2fc488e7a to your computer and use it in GitHub Desktop.
Git: Pull Request Ready to Merge

Git Commands After Pull Request Is Ready to Merge

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  
  1. 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
  1. 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
    
  2. 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>
  1. Force push feature branch to remote
git push --force
  1. After the PR is merged, delete local feature branch and pull latest from origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment