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
This commit is contained in:
parent
1aaf15e943
commit
de2918071e
4 changed files with 318 additions and 0 deletions
|
|
@ -5,3 +5,24 @@
|
|||
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue