config/shell: utilise git for file merges

This commit is contained in:
xeruf 2021-06-04 13:43:56 +02:00
parent 29e55772b2
commit 5c2eac73b1
2 changed files with 5 additions and 2 deletions

View File

@ -3,7 +3,9 @@ alias g="git"
alias bfg="java -jar $HOME/daten/applications/bfg-1.13.0.jar"
alias magit='nvim -c MagitOnly'
alias y='yadm'
y() {
test "$#" -eq 0 && yadm s || yadm "$@"
}
yc() {
echo "config/$1:" >/tmp/yc-msg
yadm commit -v --template /tmp/yc-msg ${@:2} -- "$XDG_CONFIG_HOME/$1"

View File

@ -8,11 +8,12 @@ if test "$#" -gt 0
( stats "$orig" "$1"; dif "$orig" "$@" ) |
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
test "$?" -eq "2" && exit 1
echo "y|r to restore, n|d to delete"
echo "y|r to restore, n|d to delete, m to merge"
read reply
case "$reply" in
(y|r) st-restore "$1";;
(n|d) rm -v "$1";;
(m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";;
esac
else find -name '*sync-conflict*' -exec st-diff '{}' \;
fi