-
-
Save amatmv/f868ab875fe964e57128792ed93f1d1d to your computer and use it in GitHub Desktop.
git-squash: script to create a squashed patch from a branch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Produce a squash-commit patch from a branch of changes | |
# Usage example: sh git-squash.sh master <branch_to_squash> | |
MASTER=$1 | |
PATCHBRANCH=$2 | |
SQUASHBRANCH="$PATCHBRANCH-squash" | |
git checkout -b "$SQUASHBRANCH" $MASTER && | |
git merge --squash "$PATCHBRANCH" && | |
git commit -a -m "Squash commit" && | |
git format-patch "$MASTER" --stdout > "squash.patch" && | |
git checkout "$PATCHBRANCH" && | |
git branch -D "$SQUASHBRANCH" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment