Skip to content

Instantly share code, notes, and snippets.

@nordinrahman
Last active June 2, 2022 06:30
Show Gist options
  • Save nordinrahman/4876d6b6a766a86bd30d06c7ea6e001c to your computer and use it in GitHub Desktop.
Save nordinrahman/4876d6b6a766a86bd30d06c7ea6e001c to your computer and use it in GitHub Desktop.
Git Config File template
[user]
email = YOUREMAIL@EXAMPLE.COM
name = YOURNAME
[core]
autocrlf = true
editor = \"C:/Program Files/Notepad2/Notepad2.exe\"
pager = diff-so-fancy | less --tabs=4 -RFX
[diff]
algorithm = histogram
[i18n]
logOutputEncoding = utf-8
[fetch]
prune = true
[pull]
rebase = true
pruneTags = true
[alias]
a = add
addremove = add -A
aliases = config --get-regexp alias
amend = commit --amend
br = branch
brc = !printf \"%s\" \"$(git branch | grep -E \"^\\* \" | sed s/^\\*\\ //)\" > /dev/clipboard
brd = !(git branch -r | grep " origin/develop" &>/dev/null && echo "develop") || (git branch -r | grep " origin/main" &>/dev/null && echo "main") || echo "master"
brdel = !git-brdel.sh
c = commit -m
ca = commit --amend -C HEAD
ci = commit
cia = commit --amend
ciall = !git addremove && git ci
cis = commit -s
cleanhead = !git checkout . -f && git reset head --hard && git clean -d -f
cleanall = clean -x -d -f
cleanup = !git remote prune origin && git gc && git clean -dfx && git stash clear
co = checkout
cod = !git checkout $(git brd)
cp = cherry-pick
d = diff
dc = diff --cached
hide-change = update-index --assume-unchanged
hist = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) [%an]%Creset' --graph --abbrev-commit --date=relative
ir = !git rebase -i origin/master
l = log
l1 = log --pretty=format:'%s * %an, %ar' --graph
l2 = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
l3 = log --pretty=format:'%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]' --decorate
last = cat-file commit HEAD
lf = !git hist --first-parent
lg = !git hist
lu = !git ls-files -v | grep '^[[:lower:]]'
optimize = !git fsck --unreachable && git reflog expire --expire=0 --all && git repack -a -d -l && git prune && git gc --aggressive
pf = !git fetch --prune && git cod && git pull
pfm = !git fetch --prune && git co main && git pull
pfmr = !git brc && git pfm && git co "$(cat /dev/clipboard)" && git rebase main
pfr = !git brc && git pf && git co "$(cat /dev/clipboard)" && git rebase $(git brd)
pp = !git pull && git push
pullr = pull --rebase
pushf = push --force-with-lease
pushsu = push --set-upstream
rb = rebase --committer-date-is-author-date
resettfs = reset origin_tfs/tfs
retag = tag -f
show-change = update-index --no-assume-unchanged
showfile = show --pretty=\"format:\" --name-only
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
st = status
standup = log --since yesterday --oneline --author 'YOURNAME'
stats = diff --stat
taglist = !git tag | grep -v "^TFS_C"
today = log --stat --since='1 day ago' --graph --pretty=oneline --abbrev-commit --date=relative
undo = reset head~
unstage = reset HEAD --
unwip = git log -n 1 | grep -q -c wip && git reset HEAD~1
up = !git fetch origin && git rebase origin/master
wdiff = diff --word-diff
who = shortlog -s -e --no-merges --
wip = \"git add -A
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
[interactive]
diffFilter = diff-so-fancy --patch
[color]
# Enable colors in color-supporting terminals
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
func = 146 bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment