git aliases improved + add git backup alias

This commit is contained in:
MorganGeek 2020-07-02 15:51:10 +02:00
parent dbd9fda324
commit 8e48d807d9

View File

@ -272,7 +272,7 @@ function git-project {
local preview='lsd --color always --icon always --group-dirs first {}' 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") local dir=$(find $REPO_PATH -maxdepth 3 -type d -name ".git" | sed 's#.git$##' | fzf --select-1 --query="$*" --preview "$preview")
if [[ -n "$dir" ]]; then if [[ -n "$dir" ]]; then
cd "$dir" cd "$dir" || exit
fi fi
} }
function jenkins-cli { function jenkins-cli {
@ -304,10 +304,10 @@ function gitpushallremote {
done done
} }
function clone { 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" echo "$folder"
gcls "$1" gcls "$1"
cd "$folder" cd "$folder" || exit
copyhooks copyhooks
} }
function colorpic { function colorpic {
@ -326,3 +326,6 @@ function rssadd {
ansible 127.0.0.1 -m lineinfile -a "path=~/.newsboat/urls line='"$1"'" ansible 127.0.0.1 -m lineinfile -a "path=~/.newsboat/urls line='"$1"'"
newsboat newsboat
} }
function backupgithub {
curl -sL "https://api.github.com/users/$1/repos" | jq -r '.[] | .ssh_url' | xargs -n1 git clone --mirror --no-hardlinks
}