Skip to content

Instantly share code, notes, and snippets.

@SixFiveSoftware
Created November 28, 2017 15:54
Show Gist options
  • Save SixFiveSoftware/168b77085e9edd4285b78ee59fde7edf to your computer and use it in GitHub Desktop.
Save SixFiveSoftware/168b77085e9edd4285b78ee59fde7edf to your computer and use it in GitHub Desktop.
git config in user root - change your name and email
# change `excludesfile` location
# change `standup` email address
# change `user`: `name` and `email`
# change `commit`: `template` location
[core]
editor = vim
excludesfile = /Users/user/.gitignore_global
[remote "origin"]
push = HEAD
#defaults for any master branches
[branch "master"]
remote = origin
merge = refs/heads/master
push = HEAD
# default size of gui
[gui]
geometry = 1135x731+44+44 201 168
commitmsgwidth = 50
[alias]
# Single line log
slog = log --oneline
# File names in logs
flog = log --name-only --relative-date --abbrev-commit
# colorful log (format syntax test)
clog = log --format=format:"%Cgreen%h%Creset-%C(yellow)%s%Creset%n%b"
# commit all modified files (doesn't do untracked)
acom = commit -a
# stage deleted tracked files
df = add -u
# checkout new commit
co = checkout
com = checkout master
# new branch
nb = checkout -b
# short syntax for working directory status
s = status -sb
# word-level diff (instead of line level)
d = diff --word-diff
# super awesome colored graph log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
# ammend my last commit
fix = "commit -a --amend -C HEAD"
# update feature branch from the lastest remote master
sync = "!f() { echo Syncing with master && git checkout master && git pull && git checkout - && git rebase master; }; f"
# delete and recreate a rebased remote branch
rebuild = "!f() { echo Rebuilding $1 from remote && git checkout master && git branch -D $1 && git checkout -t origin/$1; }; f"
# Hard reset to a rebased remote branch
reorig = "reset --hard HEAD@{upstream}"
restream= "reset --hard HEAD@{upstream}"
# hard reset
hr = "reset --hard"
# delete a branch
db = "!f() { git branch -d $1 && git remote prune origin; }; f"
# remove untracked files
rut = "clean -f"
# remove deleted remote branches
rp = "remote prune origin"
# rebase continue
rb = "rebase"
# rebase continue
rbm = "rebase master"
# rebase continue
rc = "rebase --continue"
# rebase interactively
ri = "rebase -i"
# rebase onto master interactively
rim = "rebase master -i"
# abort an in progress rebase
fuckit = "rebase --abort"
# order branches by last commit date
latest = "for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'"
# two days of commits
standup = "log --since '2 days ago' --oneline --author [email protected]"
# push and track new branch
po = push -u origin
[push]
# push only current branch to its upstream unless specified
default = upstream
[pull]
# pull only current branch unless specified
default = current
# only rebase divergent remotes on pull
rebase = true
# color our gits
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
# fix my typos for me
[help]
autocorrect = 1
# me, myself
[user]
name = user name
email = [email protected]
# help me with conflicts
[merge]
tool = diffmerge
[mergetool "diffmerge"]
cmd = diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE
trustExitCode = true
[mergetool]
keepBackup = false
[core "pull"]
rebase = true
[rebase]
autosquash = true
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = diffmerge $LOCAL $REMOTE
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
# [commit]
# template = /Users/user/.stCommitMsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment