=various edits and improvments
This commit is contained in:
parent
71e8da7289
commit
f38f61cc6d
6 changed files with 230 additions and 191 deletions
16
_home/private_dot_local/bin/executable_git-save-changes
Normal file
16
_home/private_dot_local/bin/executable_git-save-changes
Normal file
|
@ -0,0 +1,16 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
pushd . > /dev/null
|
||||
cd $(git rev-parse --show-toplevel)
|
||||
ARCHIVE=${1:-/tmp/$(basename $PWD .git)-$(git branch --show-current).git}
|
||||
[[ -d "$ARCHIVE" || "$ARCHIVE" != "${ARCHIVE%/}" ]] \
|
||||
&& ARCHIVE=${1%/}/$(basename $PWD .git)-$(git branch --show-current).git
|
||||
DIRNAME=$(dirname $ARCHIVE)
|
||||
[[ ! -d "$DIRNAME" ]] \
|
||||
&& echo "Directory $DIRNAME is missing, creating it..." \
|
||||
&& mkdir -p $DIRNAME
|
||||
ARCHIVE=$DIRNAME/$(basename $ARCHIVE .tgz).tgz
|
||||
printf "Archiving into %s...\n\n" "$ARCHIVE"
|
||||
tar czvf $ARCHIVE $(git diff --diff-filter=ACMRT --name-only "${@:2}") \
|
||||
&& printf "\nDone.\n\n"
|
||||
popd > /dev/null
|
Loading…
Add table
Add a link
Reference in a new issue