Skip to content

Instantly share code, notes, and snippets.

@danielnolan
Forked from lgmkr/git-rebase.markdown
Last active January 28, 2019 15:36
Show Gist options
  • Save danielnolan/6cb0fe716cc7cf2774039b9f74647d9b to your computer and use it in GitHub Desktop.
Save danielnolan/6cb0fe716cc7cf2774039b9f74647d9b to your computer and use it in GitHub Desktop.
Git rebase workflow

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit

Update branch

 git checkout <branchname>
 git rebase origin/develop

Squash Last N Commits Against Develop

 git rebase --interactive origin/develop

Squash Last N Commits Locally Without Pulling In Upstream Changes From Develop

 git rebase -i HEAD~<n>
 or
 git rebase -i <after-this-commit-sha1>

Conflicts

  1. Resolve conflict my looking at the files in question.
  2. git add
  3. git rebase --continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment