dotfiles/.config/shell/aliases
Alexander Hess de2918071e
Add configuration for git
- Add .config/git/config
  + Define aliases
  + Configure default behavior in various situations
  + Add user information with signing key
- Add .config/git/commit_msg_template.txt
- Add .config/git/ignore
- Integrate `git` aliases into the shell
2025-08-30 11:19:43 +02:00

28 lines
713 B
Bash

#!/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