vcs: Fix git program structure

This commit is contained in:
Marty Oehme 2024-09-19 11:03:36 +02:00
parent 98bfbca738
commit f6b1c5ff2e
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
4 changed files with 1 additions and 1 deletions

77
vcs/git/config/git/config Normal file
View file

@ -0,0 +1,77 @@
[user]
email = marty.oehme@gmail.com
name = Marty Oehme
signingkey = 73BA40D5AFAF49C9
[init]
defaultBranch = main
[core]
pager = git delta
[pager]
difftool = true
[interactive]
diffFilter = git delta --color-only
[merge]
conflictstyle = diff3
[delta]
navigate = true
line-numbers = true
syntax-theme = base16
[sendemail]
smtpserver = "/usr/bin/msmtp"
annotate = yes
[alias]
ignore = "!gitignore -f"
last = "diff HEAD~ HEAD"
pushall = "!git remote | xargs -I R git push R" # push to all connected remotes
fetchall = "!git remote | xargs -I R git fetch R" # fetch from all connected remotes
diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose
diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter
diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing
delta = "![ $TERM_DARK = false ] && delta --light || delta" # Take care that we always display right color scheme
[commit]
gpgsign = true # sign commits as me
verbose = true # Always show diff when preparing commit message
[fetch]
prune = true # remove references to non-existent remote branches
[pull]
rebase = true # always rebase on pulling, obviates merge commits
[diff]
colorMoved = zebra # also color stuff that has simply been moved, in a classy zebra-color
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[color "diff"]
meta = "9"
frag = "magenta bold"
commit = "yellow bold"
old = "red bold"
new = "green bold"
whitespace = "red reverse"
[color "diff-highlight"]
oldNormal = "red bold"
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
[rebase]
autostash = true
autoSquash = true
# Make use of git urls for git{lab,hub}, but only do so for pushing
# since pulling will create troubles with some applications
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
pushInsteadOf = "http://github.com/"
pushInsteadOf = "gh:"
[url "git@gitlab.com:"]
pushInsteadOf = "https://gitlab.com"
pushInsteadOf = "http://gitlab.com"
[url "git@git.martyoeh.me:"]
pushInsteadOf = "https://git.martyoeh.me"
pushInsteadOf = "http://git.martyoeh.me"
pushInsteadOf = "git@martyoeh.me"
pullInsteadOf = "git@martyoeh.me"
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true

74
vcs/git/config/git/ignore Normal file
View file

@ -0,0 +1,74 @@
# Created by https://www.gitignore.io/api/vim,linux,zsh
# Edit at https://www.gitignore.io/?templates=vim,linux,zsh
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# Coc configuration directory
.vim
### Zsh ###
# Zsh compiled script + zrecompile backup
*.zwc
*.zwc.old
# Zsh completion-optimization dumpfile
*zcompdump*
# Zsh zcalc history
.zcalc_history
# A popular plugin manager's files
._zplugin
.zplugin_lstupd
# zdharma/zshelldoc tool's files
zsdoc/data
# robbyrussell/oh-my-zsh/plugins/per-directory-history plugin's files
# (when set-up to store the history in the local directory)
.directory_history
# MichaelAquilina/zsh-autoswitch-virtualenv plugin's files
# (for Zsh plugins using Python)
.venv
# Zunit tests' output
/tests/_output/*
!/tests/_output/.gitkeep
# End of https://www.gitignore.io/api/vim,linux,zsh

View file

@ -0,0 +1,118 @@
#!/usr/bin/env sh
if ! exist git; then
return 1
fi
# print git version output and get raw version number by stripping prefix
git_version=$(git --version 2>/dev/null)
git_version="${git_version##git version }"
alias g='git'
if exist lazygit; then
alias lg="lazygit"
fi
alias ga='git add'
alias gaa='git add --all'
alias gai='git add -i'
alias gc='git commit -v'
alias gc!='git commit -v --amend'
alias gcn!='git commit -v --no-edit --amend'
if version_at_least 2.23 "$git_version"; then
alias gcm='git switch master 2>/dev/null || git switch main'
alias gcd='git switch develop 2>/dev/null || git switch staging'
gcb() {
git switch "$@" 2>/dev/null || git switch -c "$@"
}
else
alias gcm='git checkout master 2>/dev/null || git checkout main'
alias gcd='git checkout develop'
alias gcb='git checkout -b'
fi
alias gco='git checkout'
alias gi='git ignore'
# normal diff
alias gd='git diff'
alias gds='git diff --staged'
# word-based diff (with custom word regex)
alias gdw='git diffword'
alias gdws='git diffword --staged'
# side-by-side diff
alias gdd='git diffside'
alias gdds='git diffside --staged'
# syntax-based diff
if exist difft; then
alias gdy='git diffsyn'
alias gdys='git diffsyn --staged'
fi
alias gdd='git diffside'
alias gdds='git diffside --staged'
# show last committed content
alias gdl='git last'
# show quick log overview
alias glg='git log --oneline --decorate --graph'
alias glga='git log --oneline --decorate --graph --remotes --all'
# show quick log overview - with dates
alias glgd="git log --graph --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'"
alias glgad="git log --graph --remotes --all --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'"
# show detailed log overview
alias glog='git log --stat'
# show detailed log overview with contents
alias gloog='git log --stat -p'
alias gf='git fetch'
alias gfa='git fetchall'
alias gl='git pull'
alias gpn='git push --dry-run'
alias gp='git push'
alias gpf!='git push --force'
alias gpm='git pushmerge'
alias gpa='git pushall'
alias grv='git remote -v'
alias grs='git restore --staged'
alias grs!='git restore'
alias grb='git rebase'
alias grbi='git rebase -i'
alias grbc='git rebase --continue'
alias grbm='git rebase master || git rebase main'
alias gst='git status'
alias gstp='git stash pop'
alias gstl='git stash list'
alias gstL='git stash list --stat'
if version_at_least 2.13 "$git_version"; then
alias gsta='git stash push'
else
alias gsta='git stash save'
fi
if exist git-bug; then
gb() {
if [ "$#" -eq 1 ]; then
git bug show "$1"
else
git bug ls "$@"
fi
}
alias gbt='git bug termui'
alias gba='git bug add'
alias gbm='git bug comment add'
alias gbc='git bug status close'
alias gbp='git bug push'
alias gbl='git bug pull'
fi
unset -v git_version