diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-15 12:09:07 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-15 12:09:07 +0200 |
commit | 2321b913f89f2bc678c8931db05e0eb5898d7191 (patch) | |
tree | 3bf8713cdfa84c4cda127e957f31b3cf27fee727 /config | |
parent | dd75534e1878d7934d0a402a70e20d24226fcd8e (diff) |
[functions.zsh] added ginit
function to init a dir on db remote
Diffstat (limited to 'config')
-rw-r--r-- | config/essentials/zsh/functions.zsh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 0d4b8a5..6c2437f 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -138,16 +138,24 @@ sgd () { unset d } -# Git functions +ginit() +{ + [ "$1" ] || return 1 + ssh db /var/git/initdir.sh "$1" + git remote add origin git@db:"$1.git" + git push --set-upstream origin $(git_current_branch) +} + # Returns current branch -function git_current_branch() +git_current_branch() { command git rev-parse --git-dir &>/dev/null || return git branch --show-current } # Check if main exists and use instead of master -function git_main_branch() { +git_main_branch() +{ command git rev-parse --git-dir &>/dev/null || return local ref for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do |