My config for version control systems I use (overwhelmingly git + GitHub).
:header-args+: :tangle ~/.gitconfig[user]
email = harisgusic.dev@gmail.com
name = Haris Gušić
signingkey = 2333BDF9F505C46F2E3F5FDB0348E6D2D1D44A6D
[include]
path = ~/.local.gitconfig
[core]
autocrlf = input
pager = less -F -X
editor = nvim
whitespace = trailing-space
filemode = false
excludesfile = ~/.global.gitignore # This file is tangled from ~/.haris/vcs.org
[apply]
whitespace = fix
[format]
signOff = true
[init]
defaultBranch = main
[commit]
gpgsign = true
[clone]
depth = 300
[push]
recurseSubmodules = check
autoSetupRemote = true
[pull]
rebase = false
[github]
user = veracioux# Configure branches with this as pushRemote to effectively block pushes
[remote "null"]
url = /dev/null
[remote "self"]
url = ./[alias]
i = init
s = status
a = add
b = branch
m = merge
mi = merge --into-name
chx = update-index --chmod=+x
root = rev-parse --show-toplevel # Needed for older versions of git
cr = commit --allow-empty -m REBASE
rmc = rm --cached -rsc = sparse-checkout
scl = sparse-checkout list
sci = sparse-checkout init
scs = sparse-checkout set
sca = sparse-checkout add
scd = sparse-checkout disable
scr = sparse-checkout reapply[alias]
ls = ls-tree -r --name-only
lsh = ls-tree -r --name-only HEAD
lsm = ls-tree -r --name-only master[alias]
l = ldog --pretty=format:'%C(magenta bold)%h%Creset \
-%C(auto)%d%Creset %s' \
--abbrev-commit --date=short
ll = ldog --pretty=format:'%C(magenta bold)%h%Creset \
-%C(auto)%d%Creset %s %C(brightcyan)(%ad)' \
--abbrev-commit --date=short
lll = ldog --pretty=format:'%C(magenta bold)%h%Creset \
-%C(auto)%d%Creset %s %C(brightcyan)(%ad) %C(brightblue)<%an>' \
--abbrev-commit --date=short
lpf = log --pretty=fuller
ldog = log --decorate --oneline --graph
whenadded = log --diff-filter=A[alias]
r = remote
rg = remote get-url
rgo = remote get-url origin
rgu = remote get-url upstream[alias]
d = diff
ds = diff --staged
dd = diff HEAD~1..HEAD[alias]
p = push
po = push origin
pom = push origin master
poh = push origin HEAD
pu = push upstream
puh = push upstream HEAD
pa = push all
pam = push all master[alias]
f = fetch
fo = fetch origin
fom = fetch origin master:master
fod = fetch origin develop:develop
fu = fetch upstream
fum = fetch origin master:master
fud = fetch origin develop:develop[alias]
ppo = pull origin
ppom = pull origin master
ppoh = pull origin HEAD
ppu = pull upstream
ppum = pull upstream master
ppuh = pull upstream HEAD[alias]
co = checkout
coh = checkout HEAD
com = checkout master
cod = checkout develop[alias]
c = commit
ci = commit -m 'Initial commit'
cc = commit --all --message
cam = commit --amend --message
extend = commit --amend --no-edit
ex = commit --amend --no-edit
# t is short for tweak
t = commit --amend --no-edit
tra = commit --amend --no-edit --reset-author[alias]
sub = submodule
foreach = submodule foreach[alias]
remain = reset --hard upstream/main
redev = reset --hard upstream/develop
redev = reset --hard upstream/develop
res = restore
uns = restore --staged[alias]
rb = rebase
rbc = rebase --continue
rba = rebase --abort[alias]
ss = stash
sl = stash list
sa = stash apply
sp = stash pop
sd = stash drop[alias]
good = bisect good
bad = bisect bad
bsr = bisect resetwt = worktree
wtl = worktree list
wta = worktree list
wtm = worktree move
wtr = worktree remove[url "https://github.com/"]
insteadOf = gh:
[url "https://github.com/veracioux/"]
insteadOf = mygh:
[url "git@github.com:veracioux/"]
insteadOf = myghg:
[url "git@github.com:"]
insteadOf = ghg:
[url "https://gitlab.com/"]
insteadOf = gl:
[url "git@gitlab.com:"]
insteadOf = glg:
[url "git@gitlab.com:veracioux/"]
insteadOf = myglg:
[url "file://«eval-user-home()»/mnt/"]
insteadOf = mnt:
[url "file://«eval-user-home()»/proj/"]
insteadOf = proj:
[url "file://«eval-user-home()»/src/"]
insteadOf = src:
[url "git@veracioux.me:"]
insteadOf = me:
[url "eo-git@veracioux.me:"]
insteadOf = me-eo:
[url "ssh://aur@aur.archlinux.org/"]
insteadOf = aurg:
[url "ssh://git@heroku.com/"]
insteadOf = https://git.heroku.com/[color "diff"]
context = white
frag = magenta
meta = brightblue bold
hunk = red
old = brightred
new = brightgreen
oldMoved = yellow
newMoved = brightcyan
[color "branch"]
current = blue bold
local = brightcyan
remote = brightmagenta
upstream = magenta
[color "decorate"]
head = brightblue bold
branch = brightmagenta bold
remoteBranch = brightgreen bold.projectile
.wt*/
wt*/
*.bak
.aider*[diff "decrypt_rclone_conf"]
textconv = "rclone config show --config"
[diff "sqlite3"]
textconv = sh -c 'sqlite3 $0 .dump'#!/usr/bin/env sh
# Create a branch backup-<branchname> which is an exact copy of <branchname>
branch="$(git branch --show-current)"
git branch backup-"$branch"
git checkout backup-"$branch"
git reset --soft "$branch"
git checkout "$branch"#!/usr/bin/env bash
# Reset the local trunk branch to its remote counterpart
# The script will determine if trunk is 'master' or 'main'. If both branches
# exist, main will be used.
# For the remote, origin is used if it exists, otherwise upstream is used.
set -e
trunk="$(git branch | cut -b 3- | grep -E '^(main|master)$' | head -1)"
current="$(git branch --show-current)"
remote=""
# Verify $trunk valid
if [ -z "$trunk" ]; then
echo "Trunk branch could not be found. Aborting.." >&2
exit 1
fi
# Determine remote
if git remote | grep -q origin; then
remote="origin"
elif git remote | grep -q upstream; then
remote="upstream"
else
echo "Neither origin nor upstream were found. Aborting.." >&2
exit 1
fi
remote_trunk="$remote/$trunk"
# How many commits is trunk ahead of remote trunk
ahead="$(git rev-list --left-only "$trunk"..."$remote_trunk")"
if [ "$ahead" -gt 0 ]; then
echo "Local $trunk branch has commits ahead of $remote_trunk. Aborting.." >&2
exit 1
fi
if [ "$current" = "$trunk" ]; then
git reset --merge "$remote_trunk"
else
git fetch "$remote" "$trunk:$trunk"
fi#!/usr/bin/env sh
GIT_COMMITTER_DATE="$1" git commit --amend --no-edit --date "$1"git_protocol: ssh
prompt: enabled
pager:
aliases:
co: pr checkout
clone: repo clone
web: repo view --web
v: repo view
ls: repo list
rel: release create
prc: pr create
co: pr checkout
mp: markdown-preview[alias]
s = status
a = add
c = commit
d = diff
co = checkout
com = checkout tip
[ui]
username = Haris Gušić <harisgusic.dev@gmail.com>
(expand-file-name "~")