Last active
August 29, 2015 14:13
-
-
Save kdeloach/03e0244419833365cd8c to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
set -e | |
# Boilerplate template reference: | |
# https://github.com/oxyc/bash-boilerplate/blob/master/script.sh | |
sha1="" | |
version="0.1" | |
usage() { | |
echo -n "$(basename $0) [OPTION]... [SHA1] | |
Commit index then immediately squash into target SHA1. | |
Options: | |
-h, --help Display this help and exit | |
--version Output version information and exit | |
" | |
} | |
# Print help if no arguments were passed. | |
[[ $# -eq 0 ]] && set -- "--help" | |
# Read the options and set stuff | |
while [[ $1 = -?* ]]; do | |
case $1 in | |
-h|--help) usage >&2; exit 0 ;; | |
--version) echo "$version"; exit 0 ;; | |
*) echo "Invalid option: $1" >&2; exit 1 ;; | |
esac | |
shift | |
done | |
sha1=$1 | |
shift | |
set -x | |
git commit --fixup $sha1 | |
git rebase -i -p --autosquash $sha1~2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment