home/git: bundle homebrewn external git commands
This commit is contained in:
11
home/programs/git/scripts/git-switch-interactive.sh
Normal file
11
home/programs/git/scripts/git-switch-interactive.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
set -euo pipefail
|
||||
|
||||
if [ -n "${1:-}" ]; then
|
||||
git switch "$1"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BRANCHES=$(cat <(git branch) <(git branch --remotes) | grep --invert-match '^\*\|HEAD ->' | sed 's|^\s*||')
|
||||
CHOSEN_BRANCH=$(fzf --reverse --info=inline --preview 'git show --color {}' <<<"$BRANCHES")
|
||||
CLEAN_BRANCH_NAME=$(sed 's|^\s*.*/||' <<<"$CHOSEN_BRANCH")
|
||||
git switch "$CLEAN_BRANCH_NAME"
|
||||
31
home/programs/git/scripts/git-tcommit.sh
Executable file
31
home/programs/git/scripts/git-tcommit.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
set -euo pipefail
|
||||
|
||||
HOUR_SHIFT="$1"
|
||||
shift
|
||||
|
||||
if [[ $HOUR_SHIFT == -* ]]; then
|
||||
HOUR_SHIFT="${HOUR_SHIFT#*-}"
|
||||
OPERATOR="-"
|
||||
else
|
||||
OPERATOR="+"
|
||||
fi
|
||||
|
||||
DATE=$(date -d "now ${OPERATOR} ${HOUR_SHIFT} hours")
|
||||
|
||||
while true; do
|
||||
echo "Commiting with date: ${DATE} (${OPERATOR}${HOUR_SHIFT}h)"
|
||||
read -rp "Do you want to proceed? (y/n) " yn
|
||||
|
||||
case $yn in
|
||||
[yY] )
|
||||
break;;
|
||||
[nN] )
|
||||
exit;;
|
||||
* ) echo invalid response;;
|
||||
esac
|
||||
done
|
||||
|
||||
export GIT_COMMITTER_DATE="${DATE}"
|
||||
export GIT_AUTHOR_DATE="${DATE}"
|
||||
|
||||
git commit "$@"
|
||||
Reference in New Issue
Block a user