[user]
  name = Cody Veal
  email = cveal05@gmail.com

[github]
  user = cjhveal

[advice]
  statusHints = false

[alias]
  # add
  a = add
  aa = add --all
  ap = add --patch

  aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort

  # branch
  br = branch
  branches = branch -av
  cp = cherry-pick
  diverges = !bash -c 'diff -u <(git rev-list --first-parent "${1}") <(git rev-list --first-parent "${2:-HEAD}"g | sed -ne \"s/^ //p\" | head -1' -
  track = checkout -t
  nb = checkout -b

  # commit
  amend = commit --amend -C HEAD
  c = commit
	ca = commit --amend
	cm = commit --message
	msg = commit --allow-empty -m

  co = checkout

  # diff
  d = diff --color-words # diff by word
  ds = diff --staged --color-words
  dd = diff --color-words=. # diff by char
  dds = diff --staged --color-words=.
  dl = diff # diff by line
  dls = diff --staged

  h = help

  # log
	authors = "!git log --pretty=format:%aN | sort | uniq -c | sort -rn"
  lc = log ORIG_HEAD.. --stat --no-merges
  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
  lol = log --graph --decorate --pretty=oneline --abbrev-commit
  lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

  # merge
	m = merge
	mm = merge --no-ff
  ours   = "!f() { git checkout --ours $@ && git add $@; }; f"
  theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"

  # push/pull
  l = pull
  p = push
  sync = !git pull && git push

  # remotes
	prune-remotes = "!for remote in `git remote`; do git remote prune $remote; done"
  r = remote

  # rebase
  rb = rebase
  rba = rebase --abort
  rbc = rebase --continue
  rbs = rebase --skip

  # reset
  rh = reset --hard
  rhh = reset HEAD --hard
	uncommit = reset --soft HEAD^
  unstage = reset HEAD --
  unpush = push -f origin HEAD^:master

  # stash
  ss = stash
  sl = stash list
  sp = stash pop
  sd = stash drop
  snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"

  # status
  s = status --short --branch
  st = status

  # submodule
	sm = submodule
	sma = submodule add
	smu = submodule update --init
  pup = !git pull && git submodule init && git submodule update

  # file level ignoring
  assume   = update-index --assume-unchanged
  unassume = update-index --no-assume-unchanged
  assumed  = "!git ls-files -v | grep ^h | cut -c 3-"


[apply]
  whitespace = fix

[color]
  ui = auto

[color "branch"]
  current = yellow reverse
  local = yellow
  remote = green

[color "diff"]
  meta = yellow
  frag = magenta
  old = red bold
  new = green bold
  whitespace = red reverse

[color "status"]
  added = green
  changed = yellow
  untracked = cyan

[core]
  editor = /usr/bin/vim
  excludesfile = ~/.gitignore_global
	attributesfile = ~/.gitattributes

[diff]
	renames = copies
	mnemonicprefix = true

[diff "zip"]
  textconv = unzip -c -a

[merge]
  log = true

[merge "railsschema"]
	name = newer Rails schema version
	driver = "ruby -e '\n\
		system %(git), %(merge-file), %(--marker-size=%L), %(%A), %(%O), %(%B)\n\
		b = File.read(%(%A))\n\
		b.sub!(/^<+ .*\\nActiveRecord::Schema\\.define.:version => (\\d+). do\\n=+\\nActiveRecord::Schema\\.define.:version => (\\d+). do\\n>+ .*/) do\n\
		  %(ActiveRecord::Schema.define(:version => #{[$1, $2].max}) do)\n\
		end\n\
		File.open(%(%A), %(w)) {|f| f.write(b)}\n\
		exit 1 if b.include?(%(<)*%L)'"

[merge "gemfilelock"]
  name = relocks the gemfile.lock
  driver = bundle lock

[pager]
  color = true

[push]
  default = upstream

[rerere]
  enabled = true

[url "git@github.com:"]
  insteadOf = "gh:"
  pushInsteadOf = "github:"
  pushInsteadOf = "git://github.com/"

[url "git://github.com/"]
  insteadOf = "github:"

[url "git@gist.github.com:"]
  insteadOf = "gst:"
  pushInsteadOf = "gist:"
  pushInsteadOf = "git://gist.github.com/"

[url "git://gist.github.com/"]
  insteadOf = "gist:"

[url "git@heroku.com:"]
  insteadOf = "heroku:"
