Skip to content

Instantly share code, notes, and snippets.

@VincentHelwig
Created May 3, 2017 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VincentHelwig/5c1672aa39a44758f8a81f846c8be3b0 to your computer and use it in GitHub Desktop.
Save VincentHelwig/5c1672aa39a44758f8a81f846c8be3b0 to your computer and use it in GitHub Desktop.
[user]
name = xxx
email = xxx@domain
[push]
# Default push should only push the current branch to its push target, regardless of its remote name
default = upstream
# When pushing, also push tags whose commit-ishs are now reachable upstream
followTags = true
[color]
ui = auto
[alias]
# list aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
# shortcut for 'git status'
st = status
# shortcut for 'git commit'
ci = commit
# shortcut for 'git branch'
br = branch
# shortcut for 'git cherry-pick'
cp = cherry-pick
# shortcut for 'git checkout'
co = checkout
# shortcut for 'git diff'
df = diff
# shortcut for 'git rebase'
rb = rebase
# shortcut for 'git remote update'
ru = remote update
# shortcut for 'git pull origin'
plo = pull origin
# shortcut for 'git push origin'
pso = push origin
oops = commit --all --amend --no-edit
# shows an abbreviated git log with nice formatting
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset | %an' --abbrev-commit --date=relative
# shows my commit
lgm = log --graph --pretty=format:'%Cred%h%Creset | %C(green)%cd%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=short --author=Helwig --no-merges
# shows my commit for timesheet
lgtm = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=short --author=Helwig --no-merges
# performs 'git stash', 'git pull' and 'git stash pop' in a sequence
pu = !git stash && git pull && git stash pop
# removes all unstaged files except for .patch files.
cn = clean -df --exclude=*.patch
# locate commit where a particular file was introduced
added-file = log --diff-filter=A --
# list contributor stats for this repo
contributors = !git shortlog -n -s --no-merges $@ | cat - && echo && echo total $(git rev-list --count HEAD)
# list commits not yet pushed to remote
local = log --branches --not --remotes
# show branches that have been merged into current (HEAD) branch
merged = !git fetch --all && git branch --all --merged HEAD
# show branches that have not been merged into current (HEAD) branch
not-merged = !git fetch --all && git branch --all --no-merged HEAD
# decorated graph view of one liner summarized commits from all branches. (inspired by git-extras)
tree = log --all --graph --decorate --oneline --simplify-by-decoration
# stage and commit given file
checkin = !git stage "$*" && git commit $!
# undo local changes
undo = checkout --
# remove staged changes from the index: (1) provide file name/pattern (2) otherwise, removes all
unstage = reset HEAD --
# count modified files
count-modified = !echo $(git status --porcelain | grep -E '[^MARC]' | wc -l | awk '{ print $1 }') files modified
# clone a d.o project.
dc = !sh -c 'git clone $(git config --global user.drupal)@git.drupal.org:project/$1.git $@' -
# branch with author
branch-author = "! for branch in `git branch -r | grep -v HEAD`;do echo `git show --pretty=format:\"%Cred %cn %>|(40) %Cblue %ar %>|(80) %Creset\" $branch | head -n 1` $branch; done | sort -r"
# creates a d.o change notice.
change-notice = "!f() { echo '<ul>' && git log $1..$2 --reverse --pretty=format:'<li><a href="http://drupalcode.org/project/'$(basename `git rev-parse --show-toplevel`)'.git/commit/%H">(view commit)</a> %s</li>' && echo '</ul>'; }; f"
# list modified from branche
list-files = diff --name-only
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[core]
# Don't paginate output by default
# pager = cat
#
# Out of luck: on Windows w/o msysGit? You may have Notepad++…
# editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin
#
# If you want to use Sublime Text 2's subl wrapper:
# editor = subl -w
#
# Or Atom, perhaps:
# editor = atom --wait
#
# Sublime Text 2 on Windows:
# editor = 'c:/Program Files (x86)/Sublime Text 2/sublime_text.exe' -w
#
# Sublime Text 3 on Windows:
# editor = 'c:/Program Files/Sublime Text 3/subl.exe' -w
#
# Don't consider trailing space change as a cause for merge conflicts
whitespace = -trailing-space
[diff]
# Use better, descriptive initials (c, i, w) instead of a/b.
mnemonicPrefix = true
# Show renames/moves as such
renames = true
# When using --word-diff, assume --word-diff-regex=.
wordRegex = .
# Display submodule-related information (commit listings)
submodule = log
[fetch]
# Auto-fetch submodule changes (sadly, won't auto-update)
recurseSubmodules = on-demand
[grep]
# Consider most regexes to be ERE
extendedRegexp = true
[log]
# Use abbrev SHAs whenever possible/relevant instead of full 40 chars
# abbrevCommit = true
# Automatically --follow when given a single path
follow = true
[merge]
# Display common-ancestor blocks in conflict hunks
conflictStyle = diff3
[mergetool]
# Clean up backup files created by merge tools on tool exit
keepBackup = false
# Clean up temp files created by merge tools on tool exit
keepTemporaries = false
# Put the temp files in a dedicated dir anyway
writeToTemp = true
# Auto-accept file prompts when launching merge tools
prompt = false
[pull]
# This is GREAT… when you know what you're doing and are careful
# not to pull --no-rebase over a local line containing a true merge.
# rebase = true
# WARNING! This option, which does away with the one gotcha of
# auto-rebasing on pulls, is only available from 1.8.5 onwards.
rebase = preserve
[push]
# Default push should only push the current branch to its push target, regardless of its remote name
default = upstream
# When pushing, also push tags whose commit-ishs are now reachable upstream
followTags = true
[rerere]
# If, like me, you like rerere, uncomment these
autoupdate = true
enabled = true
[status]
# Display submodule rev change summaries in status
submoduleSummary = true
# Recursively traverse untracked directories to display all contents
showUntrackedFiles = all
[color "branch"]
# Blue on black is hard to read in git branch -vv: use cyan instead
upstream = cyan
[tag]
# Sort tags as version numbers whenever applicable, so 1.10.2 is AFTER 1.2.0.
sort = version:refname
[versionsort]
prereleaseSuffix = -pre
prereleaseSuffix = .pre
prereleaseSuffix = -beta
prereleaseSuffix = .beta
prereleaseSuffix = -rc
prereleaseSuffix = .rc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment