Skip to content

Instantly share code, notes, and snippets.

@DavidBrower
Last active March 10, 2018 15:24
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 DavidBrower/4c08c93595820de24348 to your computer and use it in GitHub Desktop.
Save DavidBrower/4c08c93595820de24348 to your computer and use it in GitHub Desktop.
Git Config
[user]
name = david.brower
email = *********
[core]
autocrlf = true
excludesfile = #file path
preloadindex = true
fscache = true
[push]
default = simple
[diff]
tool = p4merge
mnemonicprefix = true
compactionHeuristic = true
[merge]
tool = p4merge
[mergetool "p4merge"]
trustExitCode = true
keepBackup = false
[difftool]
prompt = false
[help]
autocorrect = 1
[alias]
sigf = clean -ndX #show files that would be removed
rmd = rm -r --cached #remove directory from git but leave working tree intact
c = commit
wip = commit -am "wip"
amend = commit -a --amend #amend the commit message of the latest commit
d = diff
w = !git a . && git wip && : #Stages files and commits them with the message "wip"
lg = log --pretty=format:\"%C(yellow)%h%Cred%d %Creset%s%Cgreen [%cn]%Creset\" --decorate
s = status
#stash aliases
ss = stash save
sd = stash drop
sl = stash list
sa = stash apply
sp = stash pop
s0 = stash show -p stash@{0} #show the first stash on the stack
s1 = stash show -p stash@{1} #show the second stash on the stack
s2 = stash show -p stash@{2} #show the third stash on the stack
sc = stash clear #drop all stashes on the stack
co = checkout
br = branch
cob = checkout -b #create a new branch and check it out
b = branch
la = config --get-regexp alias #view all aliases
pl = pull
ps = push
pod = push origin --delete
a = add
fp = fetch -p
dt = difftool
pr = pull --rebase #rebases local commits on top of any new commits on remote
rso = remote show origin #show fetch and push URLs
prev = checkout @{-1} #go back to the previously checked out branch
prev1 = checkout @{-2} #go back to the afore that
m = merge
cl = clean
bi = bisect
rh = reset --hard #be careful with this one! However, you can salvage dangling blobs...
rs = git reset --soft
mt = mergetool
rb = rebase
rbi = rebase -i
rbc = rebase --continue
rbr = rebase --root -i #Rebase from the root commit of the branch i.e. all commits can be squashed.
ba = branch -a #list all branches, remote and local
bd = branch -d #delete branch
dth = difftool head head~1 #difference between the current and last commit
rba = rebase --abort
bis = bisect start
big = bisect good
bib = bisect bad
bir = bisect reset
stf = ls-tree --full-tree -r HEAD #show all files in repository with their blob id
lf = ls-files #as above without the id
smc = diff --name-only --diff-filter=U #show files with merge conflicts
sfc = diff-tree --no-commit-id --name-only -r #show files in commit
sau = ls-files -v | grep '^h'
unstage = reset HEAD --
last = log -1 HEAD
vv = branch -vv #This will list out your local branches with more information
#including what each branch is tracking and if your local
#branch is ahead, behind or both.
please = push --force-with-lease
commend = commit --amend --no-edit
compare = log --left-right --graph --cherry-pick --oneline #show difference in commits between two branches branch1...branch2
l = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\"
[remote "origin"]
prune = true #always use -prune when pulling or fetching
[branch]
autosetuprebase = always
[gc]
auto = 256
[credential]
helper = wincred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment