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 cm='chezmoi'
alias gcls='git clone --depth 1 --recurse-submodules' alias gcls='git clone --depth 1 --recurse-submodules'
alias gpar='gitpushallremote' alias gpar='gitpushallremote'
alias gpcr='gitpushcurrentremote'
alias lg='lazygit' alias lg='lazygit'
alias neworigin='setorigin' alias neworigin='setorigin'
alias origin='setorigin' alias origin='setorigin'

View File

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