commit 33764a1b3f1f4d1e2adc0ff52933a54c7c5857f2 parent b287cb27dc1b41a703bb6531b05318871829de7b Author: Jacob R. Edwards <jacobouno@protonmail.com> Date: Sun, 8 Nov 2020 13:17:49 -0800 Add git functions Seperate git remote init from git remote init and set origin. Diffstat:
| M | rc/aliases/.config/aliases/git | | | 14 | +++++++++++--- |
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/rc/aliases/.config/aliases/git b/rc/aliases/.config/aliases/git @@ -3,14 +3,22 @@ alias g="git" alias gcc="git rev-list HEAD --count" -# git remote init -gitrinit() { +# initialize repository and set it as origin +git_rinit() { local rpath="${1:?Remote path not given}" local remote="${2:-git}" - ssh "$remote" "git init --bare --shared=true '$rpath'" + ssh_gitinit "$remote" "$rpath" git init git remote add origin "$remote:$rpath" git config branch.master.remote origin git config branch.master.merge refs/heads/master } + +# initialize a bare repository over ssh. +ssh_gitinit() { + local rpath="${1:?Remote path not given}" + local remote="${2:-git}" + + ssh "$remote" "git init --bare --shared=true '$rpath'" +}