git aliases for pushing branches

This commit is contained in:
MorganGeek 2020-07-08 17:09:19 +02:00
parent f0aa65ef56
commit 056fc58616
2 changed files with 12 additions and 2 deletions

View File

@ -7,6 +7,7 @@
alias cm='chezmoi'
alias gcls='git clone --depth 1 --recurse-submodules'
alias gpar='gitpushallremote'
alias gpcr='gitpushcurrentremote'
alias lg='lazygit'
alias neworigin='setorigin'
alias origin='setorigin'

View File

@ -336,12 +336,21 @@ function setorigin {
copyhooks
fi
}
function gitpushcurrentremote {
gitpushallremote "$(git_current_branch)"
}
function gitpushallremote {
local param_branch="$1"
grv
grv | grep push | awk '{print $1}' | while read -r remote
do
arrow "$remote"
if [ -z "$param_branch" ]; then
arrow "pushing all branches to $remote"
git push --all "$remote"
else
arrow "pushing $param_branch to $remote"
git push "$remote" "$param_branch"
fi
done
}
function clone {