-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
87 lines (66 loc) · 2.37 KB
/
.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
[user]
name = Paul Sweeney
email = [email protected]
[color]
pager = true
ui = true
status = auto
branch = auto
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log
pom = push origin master
cp = cherry-pick
sub = submodule
subup = submodule update --recursive
# git close [branchname] :: deletes the branch locally and on origin
close = !sh -c 'git branch -d $1 && git push origin :$1' -
close-force = !sh -c 'git branch -D $1 && git push origin :$1' -
# git mod :: returns list of modified/added files
mod = !"git status --porcelain | awk '/\\s?(M|A)/ {print $2}'"
conflicted = !"git status --porcelain | awk '/\\s?UU/ {print $2}'"
# git last [branch] :: returns SHA-1 for the last commit in the specified (or current) branch
last = !sh -c 'git log -1 --pretty=oneline $1 | grep -Po "^[0-9a-zA-Z]+"' -
# git glog [searchstring] [branch] :: Searches [branch] for commits matching [searchstring]
grep = !sh -c 'git log --pretty=oneline --reverse $2 | grep $1' -
# git current :: returns current branchname
current = !git branch 2> /dev/null | grep '\\*' | sed -e 's/\\* \\(.*\\)/\\1/'
# git pushup :: push current branch to origin (usually github)
pushup = !"git push origin `git current`"
# git curtag :: fetch the latest tag in the current repo
curtag = !"git tag | grep `date +%Y` | tail -n1"
# list tags chronologically
rtag = tag -l *12[a-z]
# push code directly to master
pullup = !"git pull --rebase && git pushup"
defaultbranch = !"[[ -e .github-branch ]] && echo $(< .github-branch) || echo 'master'"
ghrepo = !git remote show origin -n | grep 'Fetch URL:' | perl -pe 's/.*git\\@github.com://g' | perl -pe 's/.git$//'
url = !echo http://github.com/$(git ghrepo)
pr = !echo $(git url)/compare/$(git defaultbranch)...$(git current)
track = !"git branch --set-upstream-to=origin/`git current` `git current`"
curref = !"git log HEAD -n1 --oneline | cut -f1 -d ' '"
openref = !"open https://github.com/$(git ghrepo)/commit/$(git curref)"
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
editor = vim
excludesfile = ~/.gitignore
autocrlf = input
[rerere]
enabled = 1
[credential]
helper = osxkeychain
[push]
default = upstream
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[init]
defaultBranch = main