Skip to content

Instantly share code, notes, and snippets.

@eelco
eelco / git-clean-merge
Last active November 8, 2016 22:21
Script to merge branches in a way that keeps the repository history nice and clean.
#!/bin/bash
# Use the current branch as the source
SOURCE_BRANCH=`git rev-parse --abbrev-ref HEAD`
TARGET_BRANCH=${1:-master}
if [ "$SOURCE_BRANCH" = "" ]; then
# Something went wrong, but git probably already said what, just exit.
exit 1;
fi