Skip to content

Instantly share code, notes, and snippets.

@kindy
Last active June 15, 2022 00:22
Show Gist options
  • Save kindy/ad516da848e26722fc30962b94bd5285 to your computer and use it in GitHub Desktop.
Save kindy/ad516da848e26722fc30962b94bd5285 to your computer and use it in GitHub Desktop.
# vim:fdm=manual:sw=2:ts=2:et:ft=gitconfig:
[alias]
b = branch
ba = branch -a
c = commit
cf = config
ci = commit
co = checkout
dc = svn dcommit
df = diff
cd = diff --cached
gl = log --graph --pretty=format:'%h%Cred%d%Creset @%Cgreen%an%Creset %s [%ar]'
ll = log --pretty=format:'%h%Cred%d%Creset @%Cgreen%an%Creset %s [%ar]'
l2 = log --pretty=format:'%h%Cred%d%Creset @%Cgreen%an%Creset %s [%ai]'
glog = log --graph --pretty=oneline --abbrev-commit --color --decorate
l = log --decorate
m = merge
p = push
pl = pull
ps = push
psu = push -u origin HEAD
r = remote
rb = rebase
sb = show-branch
sfetch = !git svn fetch
sm = submodule
smu = submodule update
spl = !git svn fetch && git svn rebase
sps = !git svn dcommit
sr = svn rebase
st = status -uno
s = status --column
[color]
ui = auto
[push]
default = upstream
[user]
name = Kindy Lin
email = [email protected]
[pull]
ff = only
[core]
editor = vim -C
autocrlf = false
filemode = false
alias g='git'
alias ll='ls -l'
z() {
if [ $# = 0 ]; then
ls -GlFh
else
cd "$*" && ls -GlFh
fi
}
#!/bin/bash
cd ~/go/src/github.com
# https://github.com/wg/wrk
# https://github.com/wg/wrk.git
# [email protected]:valyala/fasthttp.git
url=$1
if (echo -n $url | pcregrep '^https:' >/dev/null); then
d=$(echo -n $url | pcregrep -o '(?<=com/)[^/]+')
if (echo -n $url | grep '.git$' >/dev/null); then
echo -n ''
else
url="$url.git"
fi
elif (echo -n $url | grep ':' >/dev/null); then
d=$(echo -n $url | pcregrep -o '(?<=:)[^/]+')
else
# case valyala/fasthttp.git
d=$(echo -n $1 | pcregrep -o '[^/]+')
url="[email protected]:$1"
if (echo -n $url | grep '.git$' >/dev/null); then
echo -n ''
else
url="$url.git"
fi
fi
if [ ! -e $d ]; then
mkdir $d;
fi
cd $d;
git clone $url
@kindy
Copy link
Author

kindy commented Jun 15, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment