Skip to content

Instantly share code, notes, and snippets.

@abrambailey
abrambailey / rebase.sh
Last active June 30, 2016 18:54 — forked from DennisOSRM/rebase.sh
Rebase current branch against origin/qa and squash all commits into a single one
#!/bin/sh
set -e
# Get the current branch name.
branch=`git rev-parse --abbrev-ref HEAD`
# Determine the commit at which the current branch diverged.
ancestor=`git merge-base qa HEAD`
# Stash any uncommited, changed files.
git stash --all
# Revert the branch back to the ancestor SHA.