Skip to content

Instantly share code, notes, and snippets.

@zerolab
Last active March 7, 2018 16:10
Show Gist options
  • Save zerolab/6fc30dd7321e5ac034388030c3986afd to your computer and use it in GitHub Desktop.
Save zerolab/6fc30dd7321e5ac034388030c3986afd to your computer and use it in GitHub Desktop.
Git config
[core]
excludesfile = ~/.gitignore
autocrlf = input
editor = vim
quotepath = false
safecrlf = false
[color]
ui = auto
status = auto
branch = auto
[user]
# Change to your name
name = Firstname Lastname
# Change to your email
email = [email protected]
[merge]
tool = opendiff
[alias]
gs = "status -sb"
cb = "checkout -b"
co = checkout
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
c = "commit"
ca = "commit -a"
cam = "!git add . && git commit -am"
cp = "cherry-pick"
credit = commit --amend --author "$1 <$2>" -C HEAD
m = "merge"
undo = "reset --soft HEAD~"
nuke = "!git add . && git reset --hard"
t = "tag --sort=v:refname"
po = "!git push origin"
pof = "!git push -f origin"
pt = "!git push --tags"
pot = "!git push origin master && git push --tags"
;
; Log
;
lg = "log --all --graph --pretty=format:'%Cblue%h%Creset %Cgreen[%ar]%d%Creset (%an) %s ' --abbrev-commit"
changelog = "!f() { git log --oneline --no-merges \"$1\"..HEAD; }; f"
; change this to your configured git name
today = log --since=midnight --author='Firstname Lastname' --oneline
merged = "branch -r --merged master"
merge-log = "!f() { for branch in `git branch -r --merged | grep -v HEAD`; do echo `git show --pretty=format:'%Cblue%ci [%cr]%Creset\t%Cgreen%an%Creset' $branch | head -n 1` \t$branch; done | sort -r; }; f"
;
; http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/
;
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
; Keep up to date with upstream
fu = !git fetch upstream
sync = "!git fetch upstream && git merge upstream/$(git rev-parse --abbrev-ref HEAD)"
; Cleanup
rprune = "remote prune origin"
fp = "fetch -p"
[format]
pretty = %Cblue%h%Creset %Cgreen[%ar]%Creset (%an) %s
[credential]
helper = osxkeychain
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
[push]
default = simple
[commit]
gpgsign = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment