config/git: improve aliases

This commit is contained in:
xeruf 2024-07-27 12:22:30 +03:00
parent cb4b56da96
commit b804819c6f
4 changed files with 10 additions and 8 deletions

View File

@ -148,7 +148,7 @@
cme = commit -v --edit --message # Commit with message from CLI but edit it
cad = !git diff-tree --no-commit-id --name-only -r HEAD | git commit -v --amend --pathspec-from-file=- # Amend commit with all already changed files
cap = !git commit --amend --no-edit && git push --force-with-lease
journal = !git -C $DATA commit -v $DATA/2-box/journal*
journal = !command git -C $DATA commit -v $DATA/2-box/journal*
cp = cherry-pick
cpc = cherry-pick --continue

View File

@ -37,8 +37,7 @@ gcn() {
# if in home or under XDG_CONFIG_HOME and not within a git directory, replace git by yadm
git() {
case "$1" in
(config) ;;
(clone) ;;
(config|clone|journal) ;;
(*) case "$PWD" in
($HOME|$XDG_CONFIG_HOME|$LAST_YADM)
yadm "$@"

View File

@ -0,0 +1,4 @@
#!/bin/sh -ex
# Configure git prepare-commit-msg hook that prefixes common path of changed files
git config core.hooksPath .git/hooks
ln -st .git/hooks $XDG_CONFIG_HOME/git/prepare-commit-msg

View File

@ -16,11 +16,10 @@ case "$1" in
esac
host=$1
case $host in
(socha) user=software-challenge; host=git@github.com;;
(hub|github) host=git@github.com;;
(lab) host=git@gitlab.com;;
(jf) host=gitea@git.jfischer.org;;
(ftt|"") host=git@forge.ftt.gmbh; user=janek;;
(socha) user=software-challenge; host=github.com;;
(hub|github) host=github.com;;
(lab) host=gitlab.com;;
(ftt|"") host=forge.ftt.gmbh; user=janek;;
esac
user=${3:-${user:-$(git config user.name)}}
repo=${2:-$(basename $(git root))}