Skip to content

Instantly share code, notes, and snippets.

@suewonjp
Created October 1, 2019 13:39
Show Gist options
  • Save suewonjp/f4b7cb55e2c64e43480ab44fc73dcc9c to your computer and use it in GitHub Desktop.
Save suewonjp/f4b7cb55e2c64e43480ab44fc73dcc9c to your computer and use it in GitHub Desktop.
gitconfig
[user]
name = your_name
email = your@email
[alias]
unstage = reset HEAD --
last = log -1 --stat
co = checkout
b = branch
l = log -10 --pretty=format:\"%h - %ar : %s\"
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --all
lcm = log -20 --pretty=format:\"%m %h - %ar : %s\" --cherry-mark --left-right --no-merges
s = status
ss = "!git status -s | awk '{ print $2 }'"
ir = "!f() { git rebase -i HEAD~${1:-8}; }; f"
sw = show -w
recommit = commit --amend -a -C HEAD
srecommit = commit --amend -C HEAD
change-comment = "!git commit --amend -m "
gb = "!f() { git branch | grep "$1" | tr -d '* '; }; f"
rp = rebase -p
rf = rebase -s recursive -X ours
dc = diff --cached
lstree = ls-tree -r --name-only HEAD
; Grep
g = "!f() { git log -G\"$1\"; }; f"
gd = "!f() { git log -p -G\"$1\"; }; f"
; Backup the current branch
bb = "!git tag `git symbolic-ref HEAD | cut -d"/" -f3-`-`date +%y-%m-%d_%Hh%Mm%Ss`"
; Locally ignore arbitrary files/folders
lignore = "!f() { echo $1 >> .git/info/exclude; git update-index --assume-unchanged "$1"; }; f"
; Print list of changed files at the latest commit in an easily parsable format
dno = "diff HEAD^ --name-only"
; Push commits in a more controllable way
upload = "!f() { git push origin HEAD${1:+'~'}${1}:${2:-master}; }; f"
; List aliases
la = "!git config -l | grep alias"
; Use icdiff for git diff
ic = "!f() { git icdiff ${1:-HEAD} ${2}; }; f"
; Use icdiff for git show
isw = "!f() { git icdiff ${1:-HEAD}^ ${1:-HEAD}; }; f"
; Force checkout branches
cB = "!git checkout -B `git symbolic-ref HEAD | cut -d"/" -f3-` --track "
coB = "!f() { git checkout -B $1 --track ${2:-origin}/$1; }; f"
[core]
excludesfile = ~/.gitignore_global
pager = less -r
quotepath = off
editor = vim -u ~/.vimrc --noplugin
[color]
ui = true
[merge]
tool = vimdiff
conflictstyle = diff3
prompt = false
[push]
default = simple
[icdiff]
; icdiff ( http://www.jefftk.com/icdiff ) is required
options = --highlight --line-numbers
[rebase]
autosquash = true
[rerere]
enabled = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment