dotfiles/.config/shell/aliases

29 lines
713 B
Text
Raw Normal View History

#!/bin/sh
# Aliases used in all kinds of shells
# Manage the bare `git` repository in ~/ holding the dotfiles
alias dotfiles='git --git-dir=$XDG_DATA_HOME/dotfiles --work-tree=$HOME'
# Integrate `git`
if _command_exists git; then
alias g='git'
# Make all `git` aliases become shell aliases with a "g" prefix
for al in $(git aliases-internal); do
# Only "real" (i.e., short) aliases are created
[ ${#al} -lt 7 ] && eval "alias g$al='git $al'"
done
# Check if a "main" branch exists in place of a "master" branch
git_main_branch() {
if [[ -n "$(git branch --list main)" ]]; then
echo "main"
else
echo "master"
fi
}
fi