www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit ec844189f5c74248786761489aa83e9709e99184
parent 2e7dbe75d979eab16828a0399c8bd5cf21896a90
Author: Georges Dupéron <georges.duperon@gmail.com>
Date:   Wed, 14 Mar 2018 09:05:57 +0100

Initial commit

Diffstat:
Adot.gitconfig | 2++
Agit-rebasei | 3+++
Agit-rebasei-editor | 44++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/dot.gitconfig b/dot.gitconfig @@ -0,0 +1,2 @@ +[alias] + rebasei = "!git-rebasei" diff --git a/git-rebasei b/git-rebasei @@ -0,0 +1,3 @@ +#!/bin/bash + +GIT_REBASE_I_EDITOR="${EDITOR:-editor}" EDITOR="git-rebasei-editor" git rebase -i "$@" diff --git a/git-rebasei-editor b/git-rebasei-editor @@ -0,0 +1,44 @@ +#!/bin/bash + +export EDITOR="$GIT_REBASE_I_EDITOR" + +tempfile="$(tempfile)" + +if ! (cat "$1" | grep -q "Rebase .* onto .* (.* command(s))"); then + exec editor "$@" +fi + +# how can I get the --graph with only the desired commits? + +cat "$1" \ + | sed -n -e '/^pick/ s/pick \([^ ]*\) .*$/\1/ p' \ + | tac \ + | xargs -n 1 git log -1 --oneline --decorate --graph --name-status \ + | sed -e 's~^\* \([0-9a-f][0-9a-f]* \)~pick \1~' \ + > "$tempfile" + +# with --graph, if there are actually any pipes, use: +# | sed -e 's~^\([ |\\/*]* \)\([0-9a-f][0-9a-f]* \)~\1pick \2~' \ + +echo >> "$tempfile" +echo "# Originial git rebase -i data:" >> "$tempfile" +cat "$1" | sed -e 's/^/#/' >> "$tempfile" + +editor "$tempfile" + +# p, pick +# r, reword +# e, edit +# s, squash +# f, fixup +# x, exec +# d, drop + +commands='p\|pick\|r\|reword\|e\|edit\|s\|squash\|f\|fixup\|x\|exec\|d\|drop' + +cat "$tempfile" \ + | grep -v "^#" \ + | grep -v "^ *[|\\/][ |\\/]*[^|\\/*]" \ + | tac \ + | sed -e 's~^\([ |\\/*]* \)\(\('"$commands"'\)[0-9a-f][0-9a-f]* \)~\2~' \ + | tee "$1" >&2