Skip to content

Instantly share code, notes, and snippets.

@adamdehaven
Forked from rab/.gitconfig
Created May 17, 2016 16:06
Show Gist options
  • Save adamdehaven/aac413f94c2e28ac06cccba062186cee to your computer and use it in GitHub Desktop.
Save adamdehaven/aac413f94c2e28ac06cccba062186cee to your computer and use it in GitHub Desktop.
A good starting point for ~/.gitconfig
# -*- Conf -*-
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
ui = true
# color.branch
# A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or
# never) or auto (or true), in which case colors are used only when the output is to a terminal.
# Defaults to false.
# color.interactive
# When set to always, always use colors for interactive prompts and displays (such as those used by
# "git-add --interactive"). When false (or never), never. When set to true or auto, use colors only
# when the output is to the terminal. Defaults to false.
# color.diff
# Whether to use ANSI escape sequences to add color to patches. If this is set to always, git-
# diff(1), git-log(1), and git-show(1) will use color for all patches. If it is set to true or
# auto, those commands will only use color when output is to the terminal. Defaults to false.
# This does not affect git-format-patch(1) nor the git-diff-* plumbing commands. Can be overridden
# on the command line with the --color[=<when>] option.
# color.pager
# A boolean to enable/disable colored output when the pager is in use (default is true).
# color.showbranch
# A boolean to enable/disable color in the output of git-show-branch(1). May be set to always,
# false (or never) or auto (or true), in which case colors are used only when the output is to a
# terminal. Defaults to false.
# color.status
# A boolean to enable/disable color in the output of git-status(1). May be set to always, false (or
# never) or auto (or true), in which case colors are used only when the output is to a terminal.
# Defaults to false.
# color.ui
# This variable determines the default value for variables such as color.diff and color.grep that
# control the use of color per command family. Its scope will expand as more commands learn
# configuration to set a default for the --color option. Set it to always if you want all output
# not intended for machine consumption to use color, to true or auto if you want such output to use
# color when written to the terminal, or to false or never if you prefer git commands not to use
# color unless enabled explicitly with some other configuration or the --color option.
# color.branch.<slot>
# Use customized color for branch coloration. <slot> is one of current (the current branch), local
# (a local branch), remote (a remote-tracking branch in refs/remotes/), plain (other refs).
# The value for these configuration variables is a list of colors (at most two) and attributes (at
# most one), separated by spaces. The colors accepted are:
# normal, black, red, green, yellow, blue, magenta, cyan and white;
# the attributes are:
# bold, dim, ul, blink and reverse.
#
# The first color given is the foreground; the second is the background.
# The position of the attribute, if any, doesn't matter.
[color "branch"]
current = yellow reverse
local = yellow
remote = green
# color.diff.<slot>
# Use customized color for diff colorization. <slot> specifies which part of the patch to use the
# specified color, and is one of plain (context text), meta (metainformation), frag (hunk header),
# func (function in hunk header), old (removed lines), new (added lines), commit (commit headers),
# or whitespace (highlighting whitespace errors). The values of these variables may be specified as
# in color.branch.<slot>.
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
# color.decorate.<slot>
# Use customized color for git log --decorate output. <slot> is one of branch, remoteBranch, tag,
# stash or HEAD for local branches, remote-tracking branches, tags, stash and HEAD, respectively.
# color.interactive.<slot>
# Use customized color for git add --interactive output. <slot> may be prompt, header, help or
# error, for four distinct types of normal output from interactive commands. The values of these
# variables may be specified as in color.branch.<slot>.
# color.status.<slot>
# Use customized color for status colorization. <slot> is one of header (the header text of the
# status message), added or updated (files which are added but not committed), changed (files which
# are changed but not added in the index), untracked (files which are not tracked by git), branch
# (the current branch), or nobranch (the color the no branch warning is shown in, defaulting to
# red). The values of these variables may be specified as in color.branch.<slot>.
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore-rab
[apply]
whitespace = nowarn
[branch]
autosetuprebase = always
[rerere]
enabled = 1
[log]
date = short
# date = relative
[alias]
st = status -sb
ci = commit
co = checkout
graph = log --graph --oneline --decorate=short --branches='*'
br = branch
df = diff --color-words='[^[:space:]]'
sh = show --color-words='[^[:space:]]'
lg = log -p
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
pend = cherry -v origin/master
# prefab = cherry -v origin/fabrication
[format]
pretty = '%C(yellow)%h%Creset %C(magenta)%cd%Creset %d %s'
[user]
# name =
# email =
[github]
# user =
[gitjour]
# prefix =
#For merge conflict resolution: https://gist.github.com/643979
#
# ===> .git/info/attributes (or ~/.gitattributes)
# Gemfile.lock merge=bundleinstall
# db/schema.rb merge=railsschema
#
# ===> .git/config (or ~/.gitconfig)
# [merge "bundleinstall"]
# name = bundle install
# driver = bundle install
# [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)'"
#== but the %L (set to 7) and the --marker-size option seem to not work. This looks for <<<<<<< ('<'*7)
# [merge "railsschema"]
# name = newer Rails schema version
# driver = "ruby -e '\n\
# system %(git), %(merge-file), %(%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?(%(<)*7)'"
[push]
default = simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment