zsh/aliases/git

51 lines
848 B
Plaintext
Raw Normal View History

#!/bin/zsh
ginit() {
2016-07-22 14:01:35 +00:00
git init;
git add ${*:-"."};
git commit -a -m "Initial Commit"
}
gst() {
if [[ "${vcs_info_msg_0_[2,3]}" == 'hg' ]]; then
hg status "$@"
else
git status "$@"
fi
}
gpl() {
if [[ "${vcs_info_msg_0_[2,3]}" == 'hg' ]]; then
hg pull "$@"
else
git pull "$@"
fi
}
alias gca="git commit -a"
alias gcm="git commit"
alias gco="git checkout"
alias ga="git add"
alias gap="git add --patch"
alias gpu="git push"
2016-07-22 14:01:35 +00:00
gls() {
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 "$@"
}
alias gll="gls -l"
alias glll="gls -la"