[core] # if a user sets his own ignore file, the data in this file will be not used excludesfile = /etc/gitignore editor = /usr/bin/vim pager = less -r [init] defaultBranch = master [advice] # hints in status page (like how to add/etc) statusHints = false [push] default = simple [pull] rebase = false [diff] mnemonicprefix = true algorithm = histogram colorMoved = default colorMovedWS = allow-indentation-change submodule = log [grep] extendRegexp = true lineNumber = true [status] # showUntrackedFiles = all submoduleSummary = true [merge] conflictStyle = zdiff3 [rerere] enabled = true [color] ui = true # https://www.kernel.org/pub/software/scm/git/docs/git-config.html # colors: normal, black, red, green, yellow, blue, magenta, cyan, white # valid: bold, dim, ul, blink, reverse, italic, strike [color "diff"] meta = bold yellow frag = bold blue new = green old = red newMoved = green dim oldMoved = red dim commit = magenta whitespace = reverse red dim [color "branch"] # plain meta = reverse blue white local = yellow remote = green upstream = magenta # current = red [color "status"] # unmerged header = white added = yellow changed = red untracked = cyan branch = cyan nobranch = bold yellow [color "grep"] # context, function, linenumber, match, matchContext, matchSelected, selected, separator filename = magenta [alias] co = checkout # add + commit in one step ci = commit -a # same as above with verbose civ = commit -a -v # commit shortcut cm = commit # commit verbose cmv = commit -v # commit with ammend cma = commit --amend # commit +add with ammend cmaa = commit -a --amend # commit with ammend and verbose cmav = commit --amend -v # branch br = branch -vv # branches sort by last commit date brc= branch -vv --sort=committerdate # remote branches brr= branch -vv -r # all branches bra = branch -vv -a # shortcut for status st = status --short --branch # add with verbose ad = add -v # merge mg = merge # update (pull + rebase) up = pull --rebase # last log message last = log --date=iso --decorate --stat -1 HEAD # detailed log (include log size) ll = log --date=iso --decorate --graph --log-size lla = log --date=iso --decorate --graph --log-size --all # same, but with stats lls = log --date=iso --decorate --graph --log-size --stat llsa = log --date=iso --decorate --graph --log-size --stat --all # short log (one line per log entry) ls = log --pretty=format:'%Cred%h%Creset %Cgreen%ad%Creset | %<(80,trunc)%s %Cgreen(%cr)%Creset %C(bold blue)[%an]%Creset%C(yellow)%d%Creset' --graph --date=iso --decorate lsa = log --pretty=format:'%Cred%h%Creset %Cgreen%ad%Creset | %<(80,trunc)%s %Cgreen(%cr)%Creset %C(bold blue)[%an]%Creset%C(yellow)%d%Creset' --graph --date=iso --decorate --all # terse, but with commit file info lsl = log --pretty=format:'%Cred%h%Creset %Cgreen%ad%Creset |%<(60,trunc)%s' --graph --date=iso --decorate --stat lsla = log --pretty=format:'%Cred%h%Creset %Cgreen%ad%Creset |%<(60,trunc)%s' --graph --date=iso --decorate --stat --all # log with changes (patch format) lp = log -p --pretty=fuller --abbrev-commit # revert change before add [take file from commited and overwrite local file] # revert command itself is already used rvt = checkout -- # revert add [undo an add file] # reset is the shortcut for reset HEAD rst = reset -- unstage = reset HEAD -- # diff shortcut df = diff # diff to index (cached) dc = diff --cached # diff with word difference dw = diff --word-diff # diff with stat, shows quick difference (edited to index, before add) ds = diff --stat # diff stat cached: same, but to index (after add) dsc = diff --stat --cached # info -> remote verbose info = remote -v # new log entries since last pull/fetch new = !sh -c 'git log $1@{1}..$1@{0} "$@"' # stash pretty print stashed = stash list --pretty=format:'%gd: %Cred%h%Creset %Cgreen[%ar]%Creset %s' # unpushed commits (long) unpushed = log --branches @{u}.. # unpushed short upushed = log --branches --not --remotes --simplify-by-decoration --decorate --oneline # From http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ assume = update-index --assume-unchanged unassume = update-index --no-assume-unchanged # lower case is with -v for unassume, add s for skip work tree assumed = "!git ls-files -v | grep ^[hs] | cut -c 3-" # for skip work tree (S flag in ls-files) skip = update-index --skip-worktree unskip = update-index --no-skip-worktree # small as if unassume set too skipped = "!git ls-files -v | grep ^[Ss] | cut -c 3-" # create a snapshot from the current working tree without removing the changes from the tree snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" # some helpers for basic # checkout development cod = co development # checkout master com = co master # merge development (down) mgd = merge development # merge master (up) mgm = merge master # push to ALL remotes pushall = !git remote | xargs -L1 git push --all # list tags in proper order or | sort -V tl = !git tag --list --sort=v:refname tlr= !git tag --list --sort=-v:refname # tag sort date tld = tag --sort=taggerdate tldr= tag --sort=-taggerdate