Skip to content

Instantly share code, notes, and snippets.

View amatmv's full-sized avatar
💭
🙏

Amat Martínez amatmv

💭
🙏
View GitHub Profile
@amatmv
amatmv / git-squash.sh
Last active November 10, 2020 08:12 — forked from gdalmau/git-squash.sh
git-squash: script to create a squashed patch from a branch.
#! /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" &&