From c75fed6a26321850a9c39c15255778765e900d3a Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Thu, 26 Nov 2020 20:38:26 +0100 Subject: [PATCH] config/git: make git aliases more convenient --- .config/git/config | 12 ++++++++---- .config/shell/git | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.config/git/config b/.config/git/config index be54857..a1ec983 100644 --- a/.config/git/config +++ b/.config/git/config @@ -112,11 +112,15 @@ sm = submodule update --init --recursive + cme = commit -v --edit --message # yadm - add-git = !yadm add $XDG_CONFIG_HOME/git/config $CONFIG_SHELLS/git $HOME/.local/bin/git-* - add-vim = !yadm add $XDG_CONFIG_HOME/nvim/init* - add-shell = !yadm add $CONFIG_SHELLS - add-bin = !yadm add -u $HOME/.local/bin + cgit = !yadm cme "config/git:" -- $XDG_CONFIG_HOME/git/config $CONFIG_SHELLS/git $HOME/.local/bin/git-* + cvim = !yadm cme "config/nvim:" -- $XDG_CONFIG_HOME/nvim/init* + cshell = !yadm cme "config/shell:" -- $CONFIG_SHELLS + cbin = !yadm cme "bin:" -- $HOME/.local/bin + + # data + journal = !git cme "notes/journal:" -- $(git root)/2-standards/notes/journal [filter "lfs"] clean = git-lfs clean -- %f diff --git a/.config/shell/git b/.config/shell/git index ebb927a..2849c16 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -3,6 +3,12 @@ alias g="git" alias bfg="java -jar $HOME/daten/applications/bfg-1.13.0.jar" alias magit='nvim -c MagitOnly' +alias y='yadm' +yc() { + echo "config/$1:" >/tmp/yc-msg + yadm commit -v --template /tmp/yc-msg ${@:2} -- "$XDG_CONFIG_HOME/$1" +} + # if in home or under XDG_CONFIG_HOME and not within a git directory, replace git by yadm git() { case "$1" in @@ -81,7 +87,7 @@ gitclone() { gitfork() { builtin cd "$projects_dir/_forks" - gitclone github.com "$1" "" "$3" --recurse-submodules + gitclone github.com "$1" "" "$3" --recurse-submodules || return $? test "$2" && git remote add upstream "$(gitremote github.com "$1" "$2")" git remote -v }