You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
208 lines
6.3 KiB
208 lines
6.3 KiB
# A good list of alises http://haacked.com/archive/2014/07/28/github-flow-aliases/
|
|
[alias]
|
|
a = add
|
|
br = branch
|
|
c = commit
|
|
ca = commit -a
|
|
cm = commit -m
|
|
cal = !git add -A && git commit # Commit all changes
|
|
cam = commit -am
|
|
cne = commit --no-edit
|
|
co = checkout
|
|
cp = cherry-pick
|
|
d = diff --color-words
|
|
dc = diff --cached
|
|
p = push
|
|
s = status
|
|
ss = status -s
|
|
sclone = clone --depth=1
|
|
up = pull
|
|
|
|
new = !git pull origin develop && git flow feature start
|
|
done = !git pull origin develop && git flow feature finish "$(git symbolic-ref --short HEAD | sed -n 's/^feature\\///p')"
|
|
go = !git checkout $1 && pull
|
|
master = !git checkout master && pull
|
|
develop = !git checkout develop && pull
|
|
mmm = !git fetch origin master && git rebase origin/master
|
|
ddd = !git fetch origin develop && git rebase origin/develop
|
|
|
|
g = log --graph --pretty=custom # Show custom graph
|
|
l = log --pretty=custom # Show custom log
|
|
ll = log --stat --abbrev-commit
|
|
lc = shortlog --summary --numbered # List contributors
|
|
rlc = reset --hard HEAD~1 # Remove last commit
|
|
ulc = reset --soft HEAD~1 # Undo last commit
|
|
|
|
unstage = reset HEAD
|
|
publish = "!git push --set-upstream origin $(git branch-name)"
|
|
|
|
branch-name = rev-parse --abbrev-ref HEAD
|
|
branch-diff = diff master...HEAD
|
|
branch-files = "!git diff master...HEAD --name-status | sed '/^D/d ; s/^.\\s\\+//'"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Find commits by source code
|
|
|
|
cc = "!f() { \
|
|
git log --pretty=custom --decorate --date=short -S\"$1\"; \
|
|
}; f"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Find commits by commit message
|
|
|
|
cm = "!f() { \
|
|
git log --pretty=custom --decorate --date=short --grep=\"$1\"; \
|
|
}; f"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Credit an author on the latest commit
|
|
|
|
credit = "!f() { \
|
|
if [ -n \"$1\" ] && [ -n \"$2\" ]; then \
|
|
git commit --amend --author \"$1 <$2>\" -C HEAD; \
|
|
fi \
|
|
}; f"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# List remote branches
|
|
|
|
lrb = "!f() { \
|
|
remote="${1:-origin}"; \
|
|
git ls-remote --heads "$remote"; \
|
|
}; f"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Merge GitHub pull request on top of the current branch or,
|
|
# if a branch name is specified, on top of the specified branch
|
|
|
|
mpr = "!f() { \
|
|
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
|
|
declare branch=\"${2:-$currentBranch}\"; \
|
|
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
|
|
git fetch origin refs/pull/$1/head:pr/$1 && \
|
|
git checkout -B $branch && \
|
|
git rebase $branch pr/$1 && \
|
|
git checkout -B $branch && \
|
|
git merge pr/$1 && \
|
|
git branch -D pr/$1 && \
|
|
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nClose #$1\"; \
|
|
fi \
|
|
}; f"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Remove the tag with the specified tag name if
|
|
# exists and tag the latest commit with that name
|
|
|
|
retag = "!f() { \
|
|
git tag -d "$1" &> /dev/null; \
|
|
git tag $1; \
|
|
}; f"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# So much color
|
|
[color]
|
|
ui = always
|
|
|
|
[color "branch"]
|
|
current = green bold
|
|
local = green
|
|
remote = yellow
|
|
|
|
[color "diff"]
|
|
frag = magenta
|
|
meta = yellow
|
|
new = green
|
|
old = red
|
|
|
|
[color "diff-highlight"]
|
|
oldNormal = red bold
|
|
oldHighlight = "red bold 52"
|
|
newNormal = "green bold"
|
|
newHighlight = "green bold 22"
|
|
|
|
[color "status"]
|
|
added = green reverse
|
|
changed = yellow reverse
|
|
untracked = red reverse
|
|
|
|
# Git mergetool
|
|
[merge]
|
|
tool = opendiff
|
|
|
|
[core]
|
|
editor = nano
|
|
abbrev = 12
|
|
attributesfile = ~/.gitattributes
|
|
excludesfile = ~/.gitignore
|
|
autocrlf = input
|
|
mergeoptions = --no-edit
|
|
ignorecase = false
|
|
|
|
[pager]
|
|
# Insanely beautiful diffs ==> npm install -g diff-so-fancy
|
|
diff = diff-so-fancy | less --tabs=4 -RFX
|
|
show = diff-so-fancy | less --tabs=4 -RFX
|
|
|
|
[diff "bin"]
|
|
# Use `hexdump` to diff binary files
|
|
textconv = hexdump -v -C
|
|
|
|
[pretty]
|
|
custom = "%C(magenta)%h%C(red)%d %C(yellow)%ar %C(green)%s %C(yellow)(%an)"
|
|
# │ │ │ │ └─ author name
|
|
# │ │ │ └─ message
|
|
# │ │ └─ date (relative)
|
|
# │ └─ decorations (branch, heads or tags)
|
|
# └─ hash (abbreviated)
|
|
|
|
[help]
|
|
# Correct typos
|
|
autocorrect = 1
|
|
|
|
# Any GitHub repo with my username should be checked out r/w by default
|
|
# http://rentzsch.tumblr.com/post/564806957/public-but-hackable-git-submodules
|
|
[url "git@github.com:nicksp/"]
|
|
insteadOf = "git://github.com/nicksp/"
|
|
|
|
# Rewrites of repo paths
|
|
[url "git@github.com:"]
|
|
insteadOf = "gh:"
|
|
insteadOf = "git://github.com"
|
|
pushInsteadOf = "github:"
|
|
pushInsteadOf = "git://github.com/"
|
|
pushInsteadOf = "https://github.com/"
|
|
|
|
[url "git://github.com/"]
|
|
insteadOf = "github:"
|
|
|
|
[url "git@gist.github.com:"]
|
|
insteadOf = "gst:"
|
|
pushInsteadOf = "gist:"
|
|
pushInsteadOf = "git://gist.github.com/"
|
|
pushInsteadOf = "https://gist.github.com/"
|
|
|
|
[url "git://gist.github.com/"]
|
|
insteadOf = "gist:"
|
|
|
|
# Push easily http://stackoverflow.com/a/23918418/89484
|
|
[push]
|
|
# Make `git push` automatically push relevant
|
|
# annotated tags when pushing branches out
|
|
followTags = true
|
|
default = current
|
|
|
|
# Use separate file for username / github token / etc
|
|
[include]
|
|
path = ~/.gitconfig.local
|
|
|
|
[filter "lfs"]
|
|
clean = git lfs clean %f
|
|
smudge = git lfs smudge %f
|
|
required = true
|
|
|