Created
May 15, 2016 16:05
-
-
Save juliendufresne/818638107d7c8c7bdafb06fc995667b7 to your computer and use it in GitHub Desktop.
Rebase GIT_SEQUENCE_EDITOR script
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/bash | |
# | |
# Usage: | |
# GIT_SEQUENCE_EDITOR='/path/to/this/script.sh' git rebase -i [options] [--exec <cmd>] [--onto <newbase>] [<upstream> [<branch>]] | |
# | |
# Description: | |
# This script is used as a GIT_SEQUENCE_EDITOR for the git rebase command | |
# It merge every commit into one single commit | |
# The first commit message is left as is | |
# | |
COMMIT=$(head -n 1 $1 | awk '{ print $2; }') | |
sed -i -e 's/^pick '${COMMIT}' \(.*\)$/x git commit --amend -m "\1"/' $1 | |
sed -i -e 's/^pick/f/g' $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment