Configure git

This commit is contained in:
Alexander Hess 2022-08-09 00:17:15 +02:00
commit c5ce823188
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
4 changed files with 264 additions and 0 deletions

View file

@ -0,0 +1,38 @@
#=================================================|
# SUBJECT ========================================|
#=================================================|
# - what does the commit do
# - capitalize the first word
# - use imperative mood (e.g., "Add" over "Adds")
# - do not end the line with a period
# - start with "Fix" for any fixes
#---------- 50 characters / 1 line ---------------|
#-------------------------------------------------|
#=======================================================================|
# BODY (optional) ======================================================|
#=======================================================================|
# - explain what the commit does, why it does it, and how
# - do not format the text (e.g., Markdown)
# - use multiple lines starting with "-" as bullet points
# + first sub-level
# * second sub-level
# - link to external resources for more context
#---------- 72 characters / multiple lines (and paragraphs) ------------|
#=======================================================================|
# ISSUE TRACKER (optional) =============================================|
#=======================================================================|
# - uncomment and adapt one of the lines below
# - use the "closes" keyword if applicable
# (see https://help.github.com/articles/closing-issues-using-keywords)
#-----------------------------------------------------------------------|
# Closes #41 on the issue tracker
# Fixes #42 on the issue tracker
# Resolves #43 on the issue tracker

0
.config/git/ignore Normal file
View file

View file

@ -115,3 +115,24 @@ _command_exists fdfind && alias fd='fdfind'
_command_exists neofetch && alias nf='neofetch'
_command_exists ranger && alias rn='ranger'
_command_exists screenfetch && alias sf='screenfetch'
# Integrate git
if _command_exists git; then
alias g='git'
# All git aliases become shell aliases with a 'g' prefix
for al in $(git internal-aliases); 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