[credential]
  helper = store --file ~/.cache/git/git-credentials
  helper = cache --timeout 30000

[core]
  excludesfile = ~/.config/git/gitignore

[init]
  defaultBranch = main

[pull]
  rebase = true

[alias]
  branchbydate = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'
  branchcolor = "!for ref in $(git for-each-ref --sort=-committerdate --format=\"%(refname)\" refs/heads/ refs/remotes ); do git log -n1 $ref --pretty=format:\"%Cgreen%cr%Creset %C(yellow)%d%Creset %C(bold blue)<%an>%Creset%n\" | cat ; done | awk '! a[$0]++'"
  llog = log --pretty=fuller
  logs = log --graph --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) %C(cyan)<%an>%Creset' --abbrev-commit
  nah = !git reset --hard && git clean -df
  reset-origin = !git fetch origin && git reset --hard origin/master && git clean -f -d
  reset-upstream = !git fetch upstream && git reset --hard upstream/master && git clean -f -d
  recent = "!r() { count=$1; git for-each-ref --sort=-committerdate refs/heads --format='%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --color=always --count=${count:=10} | column -ts'|';}; r"
  rl = reflog --format='%C(auto)%h %<|(20)%gd %C(blue)%cr%C(reset) %gs (%s)'
  tagdate = log --date-order --graph --tags --simplify-by-decoration --pretty=format:\"%ai %h %d\"
  undo-commit = reset HEAD~ --soft

[filter "lfs"]
  clean = git-lfs clean -- %f
  smudge = git-lfs smudge -- %f
  process = git-lfs filter-process
  required = true

[diff]
  tool = difftastic

[difftool]
  prompt = false

[difftool "difftastic"]
  cmd = difft "$LOCAL" "$REMOTE"

[color]
  ui = true
  diff = auto
  branch = auto
  status = auto

[color "status"]
  added = green bold
  changed = yellow
  deleted = red bold strike
  untracked = cyan
  branch = yellow black bold ul

[submodule]
  recurse = true

# dotfiles special config
[includeIf "hasconfig:remote.*.url:https://github.com/ivuorinen/dotfiles.git"]
  path = ~/.dotfiles/config/git/special/dotfiles ;

