-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
113 lines (97 loc) · 4.38 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
[user]
name = Ruth Linehan
email = 1530016+rlinehan@users.noreply.github.com
[includeIf "gitdir:~/github/"]
path = .gitconfig-github
[github]
user = rlinehan
#[push]
# default = simple
[credential]
helper = osxkeychain
[merge]
conflictstyle = diff3
[diff]
tool = difftastic
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[pager]
difftool = true
[color]
diff = auto
status = auto
branch = auto
[alias]
lg = "log --pretty=format:'%C(yellow)%h%C(reset) %s %C(cyan)%ar%C(reset) %C(blue)%an%C(reset) %C(green)%d%C(reset)' --graph --date-order"
# shorten for performance
lgs = "log --pretty=format:'%C(yellow)%h%C(reset) %s %C(cyan)%ar%C(reset) %C(blue)%an%C(reset) %C(green)%d%C(reset)' --graph --date-order --since='1 month ago'"
# just show this branch
lgb= "log --pretty=format:'%C(yellow)%h%C(reset) %s %C(cyan)%ar%C(reset) %C(blue)%an%C(reset) %C(green)%d%C(reset)' --graph --date-order master.."
co = "checkout --no-guess"
# checkout interactive, with branch preview, create new local branch for
# remote branches (strip `remote/origin`)
coi = "! git branch -a | cut -c 3- | fzf --reverse --preview 'git log --patch --color {}...{}~5' | sed 's:remotes/origin/::' | xargs git checkout "
# checkout a branch, given a PR number (in a centralized GitHub workflow)
copr = "! f() { git checkout `get_branch_for_pr $1` ;}; f"
# push a sha to origin on the currently named branch (creating it if
# necessary)
psha = "! f() { git push origin $1:refs/heads/`git rev-parse --abbrev-ref HEAD` ;}; f"
# force push to reset current branch to provided SHA
pshaf = "! f() { git push -f origin $1:refs/heads/`git rev-parse --abbrev-ref HEAD` ;}; f"
# pull with a rebase
repull = "! f() { git pull --rebase origin `git rev-parse --abbrev-ref HEAD` ;}; f"
st = "status"
rt = "remote"
setup = "! f() { git branch --set-upstream-to=origin/`git rev-parse --abbrev-ref HEAD` `git rev-parse --abbrev-ref HEAD` ;}; f"
ra = "! f() { git remote add $1 git@github.com:$1/$(basename $(git remote show -n origin | grep Fetch | cut -d: -f2-)); git remote -v;}; f"
cl = "! f() { git clone git@github.com:rlinehan/$1.git ;}; f"
# git vimadd <org> <repo> <branch>(optional, if not master)
vimadd = "! f() { git subtree add --prefix .vim/bundle/$2 https://github.com/$1/$2.git ${3:-master} --squash;}; f"
# git vimupdate <org> <repo> <branch>(optional, if not master)
# This... isn't entirely working in terms of what it reports
vimupdate = "! f() { git subtree pull --prefix .vim/bundle/$2 https://github.com/$1/$2.git ${3:-master} --squash -m \"Merge commit `git rev-parse FETCH_HEAD` from ${3:-master}\";}; f"
changelog = "log --pretty=format:'%ad - %aN <%aE>%n * %s (%h)%n' --date=short --date-order --no-merges --patience -M -C -C -c"
# Usage: $ git pr <remote> <pull request number> <pull request branch description>
#
# Example: $ git pr foo 37 pr-i-want-to-test
#
# Pulls down PR #37 from remote foo (assuming foo is a github repository) to
# branch PR-37-pr-i-want-to-test and checks this branch out.
pr = "! f() { git fetch $1 pull/$2/head:PR-$2-$3 && git checkout PR-$2-$3;}; f"
# Usage: $ git prupdate <remote> <pull request number>
#
# Example: $ git prupdate foo 37
#
# Fetches pull request 37 from remote foo and merges to current branch
# (usually a PR created with the `pr` alias above. Only works if PR has not
# been force-pushed to.
prupdate = "! f() { git fetch $1 pull/$2/head && git merge FETCH_HEAD;}; f"
# given a remote and a branch, fetch the remote, merge the branch locally,
# and push to Github - for use in a distributed workflow (users fork the
# repo and push to their own branches)
update = "! f() { git checkout $2 && git fetch $1 && git merge $1/$2 --ff-only && git push origin HEAD;}; f"
# checkout a branch and do a pull to update it (for use in a centralized
# GitHub workflow)
evolve = "! f() { git checkout $1 && git pull;}; f"
# amend commits other than HEAD
fancyamend = "! f() { sha=`git rev-parse $1`; git commit --fixup=amend:$sha && git rebase `git rev-parse $sha~1` -i --autosquash;}; f"
# `git dft` is less to type than `git difftool`.
dft = difftool
[rerere]
enabled = 1
[core]
editor = vim
excludesfile = ~/.git-ignore
autocrlf = input
safecrlf = true
hooksPath = /dev/null
[push]
default = current
[pull]
ff = only
[fetch]
prune = true
[init]
defaultBranch = main