Skip to content

Instantly share code, notes, and snippets.

@expede
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save expede/45aba6ae7268898c49e4 to your computer and use it in GitHub Desktop.
Save expede/45aba6ae7268898c49e4 to your computer and use it in GitHub Desktop.
git debase
# Similar to a squashed rebase
# Merges branch A into B, and then resets the branch to A,
# producing an unstaged diff of B for your commit
# exampe usage: `debase master`
# (note the lack of `git` prefix)
function debase() {
if [[ -z $1 ]]; then
echo 'missing branch to debase from'
else
branch=${1}
git merge `echo $branch` && git reset --soft $branch && git status
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment