config/git: make git aliases more convenient

This commit is contained in:
xerus2000 2020-11-26 20:38:26 +01:00
parent 200ec038f9
commit c75fed6a26
2 changed files with 15 additions and 5 deletions

View File

@ -112,11 +112,15 @@
sm = submodule update --init --recursive sm = submodule update --init --recursive
cme = commit -v --edit --message
# yadm # yadm
add-git = !yadm add $XDG_CONFIG_HOME/git/config $CONFIG_SHELLS/git $HOME/.local/bin/git-* cgit = !yadm cme "config/git:" -- $XDG_CONFIG_HOME/git/config $CONFIG_SHELLS/git $HOME/.local/bin/git-*
add-vim = !yadm add $XDG_CONFIG_HOME/nvim/init* cvim = !yadm cme "config/nvim:" -- $XDG_CONFIG_HOME/nvim/init*
add-shell = !yadm add $CONFIG_SHELLS cshell = !yadm cme "config/shell:" -- $CONFIG_SHELLS
add-bin = !yadm add -u $HOME/.local/bin cbin = !yadm cme "bin:" -- $HOME/.local/bin
# data
journal = !git cme "notes/journal:" -- $(git root)/2-standards/notes/journal
[filter "lfs"] [filter "lfs"]
clean = git-lfs clean -- %f clean = git-lfs clean -- %f

View File

@ -3,6 +3,12 @@ alias g="git"
alias bfg="java -jar $HOME/daten/applications/bfg-1.13.0.jar" alias bfg="java -jar $HOME/daten/applications/bfg-1.13.0.jar"
alias magit='nvim -c MagitOnly' 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 # if in home or under XDG_CONFIG_HOME and not within a git directory, replace git by yadm
git() { git() {
case "$1" in case "$1" in
@ -81,7 +87,7 @@ gitclone() {
gitfork() { gitfork() {
builtin cd "$projects_dir/_forks" 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")" test "$2" && git remote add upstream "$(gitremote github.com "$1" "$2")"
git remote -v git remote -v
} }