From 471da5f2d49800ded7d6999739f6b62237699e8c Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Fri, 25 Mar 2022 07:45:04 +0100 Subject: [PATCH] git.sh - set git aliases --- seqs/git.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 seqs/git.sh diff --git a/seqs/git.sh b/seqs/git.sh new file mode 100755 index 0000000..99fd4ce --- /dev/null +++ b/seqs/git.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +toolName=git + +# Get script working directory +# (when called from a different directory and even when called via symlink) +WDIR="$(cd "$(dirname -- "$(realpath ${BASH_SOURCE[0]})")" >>/dev/null 2>&1 && pwd)" +APTOPT= +CONFIG=0 +SCRIPT_FILE=$(basename -- $0) +SCRIPT_NAME=${SCRIPT_FILE%%.*} +CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" +CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" + +step_config() { + ## or to use sequencer api with global config file: + #initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" + #if [ $? -eq 0 ] ; then + # CONFIG=1 + #else + # # End if no configuration file exists + # [ $DRY -eq 0 ] && return -1 + #fi + + ## Apt cmdline option to suppress user interaction + [ $QUIET -ne 0 ] && APTOPT="-y" + + ## Return of non zero value will abort the sequence + return 0 +} + +step_1_info() { echo "Setup global git aliases"; } +step_1_alias() { ALIAS="alias"; } +step_1() { + local brConf="branch \ +--format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - \ +%(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' \ +--sort=-committerdate" + local logConf="!git log --pretty=format:\"%C(magenta)%h%Creset \ +-%C(red)%d%Creset %s %C(dim green)(%cr) [%an]\" --abbrev-commit -30" + exe git config --global alias.s 'status -s' + exe git config --global alias.st 'status' + exe git config --global alias.co 'checkout' + exe git config --global alias.ci 'commit' + exe git config --global alias.b "${brConf}" + exe git config --global alias.br 'branch' + exe git config --global alias.l "${logConf}" + exe git config --global alias.ll 'log' +} + +VERSION_SEQREV=15 +. /usr/local/bin/sequencer.sh