-
Notifications
You must be signed in to change notification settings - Fork 4
/
dot_gitconfig
67 lines (66 loc) · 3.39 KB
/
dot_gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
[user]
name = Ferran Basora
email = [email protected]
[core]
editor = nvim
excludesfile = /Users/ferranbasora/.gitignore_global
[color]
diff = auto
branch = auto
interactive = auto
status = auto
[branch]
autosetuprebase = always
[alias]
ci = commit --verbose
co = checkout
cp = cherry-pick
st = status --short
rc = rebase --continue
br = branch
cached = diff --cached
undo = reset --soft HEAD~1
show-patch = format-patch -1 --stdout
sha = rev-parse HEAD
origin = config --get remote.origin.url
current = rev-parse --abbrev-ref HEAD
out = !git log origin/$(git current)..
tree = log --graph --decorate --oneline --all
incoming = !git log ..origin/$(git current)
publish= !git push origin $(git current)
id = !echo "git clone --recursive $(git origin) --branch $(git current)"
recent = !git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ | head -n 100
fixup = "!f() { git commit --fixup=$1; git rebase -i --autosquash $1~1; }; f"
fixit = "!f() { git commit --fixup=$1; GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $1~1; }; f"
wip = !git add --all . && git commit -m 'WIP'
root = !pwd
back = checkout -
upstream = !git branch --set-upstream-to=origin/$(git current) $(git current)
repo=!git remote -v | grep '@.*fetch' | sed 's/.*:\\(.*\\).git.*/\\1/g'
pr=!open https://github.com/$(git repo)/compare/$(git current)?expand=1
# Welcome to pam/fzf heaven. xargs hell
pam= !BRANCH=`git recent | fzf` && git checkout ${BRANCH}
pamadd= !FILES=`git status -s | awk '{ print $2 }' | fzf -x -m` && git add --all ${FILES}
pamfix= !HASH=`git log --pretty=oneline | head -n 100 | fzf` && git fixit `echo ${HASH} | awk '{ print $1 }'`
pamshow= !HASH=`git log --pretty=oneline | head -n 100 | fzf` && git show `echo ${HASH} | awk '{ print $1 }'`
pamrevert= !HASH=`git log --pretty=oneline | head -n 100 | fzf` && git revert `echo ${HASH} | awk '{ print $1 }'`
pamlog= !HASH=`git log --pretty=oneline | head -n 100 | fzf` && echo ${HASH} | awk '{ print $1 }' | xargs echo -n | pbcopy
pamrebase= !HASH=`git log --pretty=oneline | head -n 100 | fzf` && git rebase -i `echo ${HASH} | awk '{ print $1 }'`^
pamvim= !FILES=`git status -s | awk '{ print $2 }' | fzf -x -m` && nvim -O ${FILES}
pamvimconflicts= !FILES=`git status -s | grep '^[UMDA]\\{2\\} ' | awk '{ print $2 }' | fzf -x -m` && nvim -O ${FILES}
pamgrep= !sh -c 'FILES=`git grep -l -A 0 -B 0 $1 $2 | fzf -x -m` && nvim -O `echo ${FILES} | cut -d':' -f1 | xargs`' -
pamvimlog= !HASH=`git log --pretty=oneline | head -n 50 | fzf` && HASHZ=`echo ${HASH} | awk '{ print $1 }'` && FILES=`git show --diff-filter=d --pretty='format:' --name-only $HASHZ | grep -v -e '^$' | fzf -x -m` && nvim -O ${FILES}
pamreset= !HASH=`git log --pretty=oneline | head -n 50 | fzf` && git reset --soft `echo ${HASH} | awk '{ print $1 }'`
pamresethard= !HASH=`git log --pretty=oneline | head -n 50 | fzf` && git reset --hard `echo ${HASH} | awk '{ print $1 }'`
[push]
default = simple
[merge "railsschema"]
name = newer Rails schema version
driver = "ruby -e '\n\
system %(git), %(merge-file), %(--marker-size=%L), %(%A), %(%O), %(%B)\n\
b = File.read(%(%A))\n\
b.sub!(/^<+ .*\\nActiveRecord::Schema\\.define(version: ([\\d_]+). do\\n=+\\nActiveRecord::Schema\\.define(version: ([\\d_]+). do\\n>+ .*/) do\n\
%(ActiveRecord::Schema.define(version: #{[$1, $2].max}) do)\n\
end\n\
File.open(%(%A), %(w)) {|f| f.write(b)}\n\
exit 1 if b.include?(%(<)*%L)'"