aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.gitconfig
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2018-05-08 01:08:24 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2018-05-08 01:08:24 +0200
commitdf2dca01f2353638f124fe21246e99d34226e8d3 (patch)
treee40b98ca3cff7a0bd677106494c844e1d17af740 /%HOME%/.gitconfig
parent.gitconfig: smarter alias.fixup (diff)
downloadlinux-home-df2dca01f2353638f124fe21246e99d34226e8d3.tar.gz
linux-home-df2dca01f2353638f124fe21246e99d34226e8d3.zip
.gitconfig: smarter alias.fixup
Diffstat (limited to '')
-rw-r--r--%HOME%/.gitconfig11
1 files changed, 8 insertions, 3 deletions
diff --git a/%HOME%/.gitconfig b/%HOME%/.gitconfig
index eaaf0e8..8e60aa8 100644
--- a/%HOME%/.gitconfig
+++ b/%HOME%/.gitconfig
@@ -36,8 +36,13 @@ f() { \
return 1 ; \
fi ; \
\
- has_staged_changes=-a ; \
- git diff --cached --quiet --exit-code || has_staged_changes= ; \
+ add=-a ; \
+ git diff --cached --quiet --exit-code || add= ; \
+\
+ if [ -z \"${add}\" ] ; then \
+ echo \"There're unstaged changes, can't rebase.\" >&2 ; \
+ return 1 ; \
+ fi ; \
\
numof_parents=`git rev-list --parents -n 1 HEAD | wc --words` ; \
if [ \"$numof_parents\" -eq 1 ] ; then \
@@ -49,7 +54,7 @@ f() { \
return 1 ; \
fi ; \
\
- git commit $has_staged_changes --fixup=HEAD && GIT_EDITOR=true git rebase -i --autosquash \"$dest_ref\" ; \
+ git commit $add --fixup=HEAD && GIT_EDITOR=true git rebase -i --autosquash \"$dest_ref\" ; \
} ; \
f ; \
"