2013-03-15 07:37:33 +00:00
|
|
|
#!/bin/zsh
|
|
|
|
ginit() {
|
2017-11-24 15:44:29 +00:00
|
|
|
git init;
|
|
|
|
git add ${*:-"."};
|
|
|
|
git commit -a -m "Initial Commit"
|
2013-03-15 07:37:33 +00:00
|
|
|
}
|
|
|
|
|
2017-11-24 15:44:29 +00:00
|
|
|
# define a function that calls different versioning systems depending on
|
|
|
|
# detected vcs for current directory
|
|
|
|
# usage: defvcsfun <command name> <parameters for git> <parameters for hg> <parameters for svn>
|
|
|
|
# see below for examples
|
|
|
|
defvcsfun() {
|
|
|
|
local name=$1; shift
|
|
|
|
local args=($@)
|
|
|
|
eval "$name() {
|
|
|
|
case \$VCS_DETECTED in
|
|
|
|
git)
|
|
|
|
git ${=args[1]} \"\$@\";;
|
|
|
|
hg)
|
|
|
|
hg ${=args[2]} \"\$@\";;
|
|
|
|
svn)
|
|
|
|
svn ${=args[3]} \"\$@\";;
|
|
|
|
*)
|
|
|
|
echo \"unknown vcs: \$VCS_DETECTED\";;
|
|
|
|
esac
|
|
|
|
}"
|
2013-03-15 07:37:33 +00:00
|
|
|
}
|
|
|
|
|
2017-11-24 15:44:29 +00:00
|
|
|
#VCS command git hg svn
|
|
|
|
defvcsfun gst "status -s" "status" "status"
|
|
|
|
defvcsfun gpl "pull" "pull" "update"
|
|
|
|
defvcsfun gcm "commit" "commit" "commit"
|
|
|
|
defvcsfun ga "add" "add" "add"
|
|
|
|
defvcsfun gpu "push" "push" "i_am_not_distributed_please_dont_push_me"
|
2013-03-15 07:37:33 +00:00
|
|
|
|
|
|
|
alias gco="git checkout"
|
2017-11-24 15:44:29 +00:00
|
|
|
alias gca="git commit -a"
|
2013-03-15 07:37:33 +00:00
|
|
|
alias gap="git add --patch"
|
2016-07-22 14:01:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
gls() {
|
2017-11-24 15:44:29 +00:00
|
|
|
zmodload zsh/mapfile
|
|
|
|
gitignore="$(git rev-parse --show-toplevel 2>/dev/null)/.gitignore"
|
|
|
|
globalgitignore="$(git config core.excludesfile)"
|
|
|
|
|
|
|
|
typeset -a ignores
|
|
|
|
for i in $gitignore $globalgitignore; do
|
|
|
|
if [[ -e $i ]]; then
|
|
|
|
for ignore in "${(f)mapfile[$i]}"; do
|
|
|
|
ignores+="--ignore=$ignore"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
ls --color=auto -h $ignores "$@"
|
2016-07-22 14:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
alias gll="gls -l"
|
|
|
|
alias glll="gls -la"
|