Skip to content

Latest commit

 

History

History
142 lines (117 loc) · 4.16 KB

git.org

File metadata and controls

142 lines (117 loc) · 4.16 KB

Introduction

First, let’s start with who I am
[user]
  name = Lee Hinman
  email = lee@writequit.org
  signingkey = 3ACECAE0

I globally ignore anything in ~/.gitignore, which allows me to ignore things like TAGS files

[core]
  excludesfile = /home/hinmanm/.gitignore

Turn on color and rerere everywhere. Additionally I default pushing to track the branch if it isn’t already.

[color]
  ui = auto

[rerere]
  enabled = 1

[push]
  default = tracking

There’s a separate diffing algorithm called “patience” that I’ve been trying out, to see if maybe it helps with conflicts and reading patches, so configure that here.

For Clojure code in particular, I set up a variable that tells git what the function name is, so for something like:

(defn myfunc [x]
  (+ 1 thing))

If you change the (+ 1 thing) line, git can use the ^\\(.* regex to display the name of the function in the diff.

[diff]
  algorithm = patience

[diff "clojure"]
  xfuncname = "^\\(.*"

Set up the various aliases that I end up using. Out of these I probably use co, rips, pr, and sync the most.

[alias]
  co = checkout
  cob = checkout -b
  cot = checkout -t
  st = status -sb
  stat = status -sb
  status = status -sb
  unpushed = log --branches --not --remotes --simplify-by-decoration --decorate --oneline
  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
  l = log --pretty="format:'%C(yellow)%h %C(red)%G? %C(blue)%aN%C(reset)  %s'" --show-signature
  lol = log --graph --decorate --pretty=oneline --abbrev-commit
  lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
  rips = rebase -i -p -s subtree
  headless = !sh -c 'git symbolic-ref HEAD refs/heads/$0 && rm .git/index && git clean -fdx'
  vtags = !sh -c 'git tag -l | xargs git tag -v'
  ver = "!git log --pretty=format:'%ai %h' -1 | perl -pe 's,(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) [^ ]+ ([a-z0-9]+),\\1\\2\\3+\\7,'"
  pr = "!f() { git fetch origin pull/$1/head:pr/$1; }; f"
  sync = annex sync

There are a couple of tools that use Github config settings, which I store in a separate file, but make available through the config here.

[github]
  user = dakrone
  token = !cat ~/.github.token
  oauth-token = !cat ~/.github.oauth-token

[ghi]
  token = !cat ~/.github.token

Finally, for the git-annex tool that I use quite a bit, I configure git-annex to automatically generate metadata for files added to a repo. Quite handy for storing pictures and not having to manually tag each one.

[annex]
  genmetadata = true

Global gitignore

Basically a list of files or directories I always want to ignore in git repositories. Since it’s read from ~/.gitconfig, I don’t have to configure every individual repository to ignore these files separately.
.tern-port
TAGS
GTAGS
GPATH
GRTAGS
GSYM*
.DS_Store
.dir-locals.el
LUCENE-*.patch
.lein-repl*
pom.xml.asc
core/data
.projectile