From 8e48d807d959c0803d06730d1abaaf15355b2753 Mon Sep 17 00:00:00 2001 From: MorganGeek Date: Thu, 2 Jul 2020 15:51:10 +0200 Subject: [PATCH] git aliases improved + add git backup alias --- dot_zsh_functions | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dot_zsh_functions b/dot_zsh_functions index ff1bdca..fe161ec 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -272,7 +272,7 @@ function git-project { local preview='lsd --color always --icon always --group-dirs first {}' local dir=$(find $REPO_PATH -maxdepth 3 -type d -name ".git" | sed 's#.git$##' | fzf --select-1 --query="$*" --preview "$preview") if [[ -n "$dir" ]]; then - cd "$dir" + cd "$dir" || exit fi } function jenkins-cli { @@ -304,10 +304,10 @@ function gitpushallremote { done } function clone { - local folder=$(echo $1 | \grep -Eo '[a-zA-Z_-]+.git$' | cut -d'.' -f1) + local folder=$(basename $1 | sed 's/\.git.*//g') echo "$folder" gcls "$1" - cd "$folder" + cd "$folder" || exit copyhooks } function colorpic { @@ -326,3 +326,6 @@ function rssadd { ansible 127.0.0.1 -m lineinfile -a "path=~/.newsboat/urls line='"$1"'" newsboat } +function backupgithub { + curl -sL "https://api.github.com/users/$1/repos" | jq -r '.[] | .ssh_url' | xargs -n1 git clone --mirror --no-hardlinks +}