My config for version control systems I use (overwhelmingly git + GitHub).
:header-args+: :tangle (haris/tangle-home “.gitconfig”)[user]
email = [email protected]
name = Haris Gušić
signingkey = 2333BDF9F505C46F2E3F5FDB0348E6D2D1D44A6D
[include]
path = ~/.gitconfig.private
[core]
autocrlf = input
pager = less -F -X
editor = vim
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
[github]
user = veracioux
# Configure branches with this as pushRemote to effectively block pushes
[remote "null"]
url = /dev/null
[alias]
i = init
s = status
a = add
b = branch
m = merge
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 -r
sc = 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 = commit --amend --no-edit
[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 reset
wt = 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 "[email protected]:veracioux/"]
insteadOf = myghg:
[url "[email protected]:"]
insteadOf = ghg:
[url "[email protected]:"]
insteadOf = me:
[url "[email protected]:"]
insteadOf = me-eo:
[url "https://gitlab.com/"]
insteadOf = gl:
[url "[email protected]:"]
insteadOf = glg:
[url "[email protected]:veracioux/"]
insteadOf = myglg:
[url "ssh://[email protected]/"]
insteadOf = aurg:
[url "ssh://[email protected]/"]
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
#!/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
[alias]
s = status
a = add
c = commit
d = diff
co = checkout
com = checkout tip
[ui]
username = Haris Gušić <[email protected]>