Add --autostash to git pull and add clone https-to-git autoconvert

This commit is contained in:
crater2150 2019-05-14 14:44:02 +02:00
parent 4fa5b14ba1
commit 8802c2ebb7

View file

@ -28,7 +28,7 @@ defvcsfun() {
#VCS command git hg svn #VCS command git hg svn
defvcsfun gst "status -s" "status" "status" defvcsfun gst "status -s" "status" "status"
defvcsfun gpl "pull" "pull" "update" defvcsfun gpl "pull --autostash" "pull" "update"
defvcsfun gcm "commit" "commit" "commit" defvcsfun gcm "commit" "commit" "commit"
defvcsfun ga "add" "add" "add" defvcsfun ga "add" "add" "add"
defvcsfun gpu "push" "push" "i_am_not_distributed_please_dont_push_me" defvcsfun gpu "push" "push" "i_am_not_distributed_please_dont_push_me"
@ -57,3 +57,26 @@ gls() {
alias gll="gls -l" alias gll="gls -l"
alias glll="gls -la" alias glll="gls -la"
gclone() {
local oldurl
local url=$1
shift
local git_hosts=(
gitlab2.informatik.uni-wuerzburg.de
github.com
)
for host in $git_hosts; do
if [[ "$url" =~ "^https://$host" ]]; then
oldurl=$url
url=${url//https:\/\/$host\//git@$host:}
fi
done
if [[ -n "$oldurl" ]]; then
echo "Correcting url to $url"
fi
git clone $url "$@"
}