forked from divad12/khan-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 17
/
.gitconfig.khan
70 lines (61 loc) · 4.07 KB
/
.gitconfig.khan
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
[branch]
# autosetupmerge auto-adds the --track flag to each git branch,
# which is helpful for git pr (part of our-lovely-cli). autosetuprebase
# means that instead of merging it will rebase. Weird you need both!
# NOTE (Lilli): It feels weird that you would need both, because the
# names of the config options *suggest* that they are related to each other,
# but they are not. autosetupmerge is about which branch your new branch will
# track, the one off of which it was checked out from, or the same-name remote.
# And autosetuprebase is about rebasing or merging when you pull.
autosetupmerge = always
autosetuprebase = always
[alias]
# Versions of commands that handle submodules properly.
# co will also try to convert a git PR to a tag if it can.
co = "!f() { if [ -n \"$1\" -a -z \"$2\" ]; then git checkout "`revisionid-to-diffid.sh --tag \"$@\"`"; else git checkout \"$@\"; fi && git submodule update --init --recursive; }; f"
p = "!f() { git pull \"$@\" && git submodule update --init --recursive && if [ -s tools/hook-check.sh ]; then tools/hook-check.sh --fast; fi; }; f"
m = "!f() { git merge \"$@\" && git submodule update --init --recursive && if [ -s tools/hook-check.sh ]; then tools/hook-check.sh --fast; fi; }; f"
gsu = "!f() { git submodule sync --recursive && git submodule update --init --recursive && if [ -s tools/hook-check.sh ]; then tools/hook-check.sh --fast; fi; }; f"
# Branch management for dealing with github-style deploys.
# e.g. deploy-branch, review-branch, find-reviewers
# Note that these reference scripts from Khan/git-workflow
# Those scripts should be installed and part of the default path.
rgrep = !git recursive-grep
findreviewers = !git find-reviewers ; old-style had no dash in name
# Abbreviations for KA specific tools
db = !git deploy-branch
rb = !git review-branch
pr = !git pull-request
prs = !git pull-requests
# Other useful commands.
outgoing = "!git fetch >/dev/null 2>&1; git log @{upstream}..HEAD"
incoming = "!git fetch >/dev/null 2>&1; git log HEAD..@{upstream}"
update-submodule = !bash -c 'git pull --no-rebase && pushd $1 && git co master && git pull && popd && git commit ${1%/} -m Substate\\ for\\ ${1%/} -m Test\\ plan: -m None && git push' --
branch-name = "!git rev-parse --abbrev-ref HEAD"
pup = "!git push origin $(git branch-name)"
pown = "!git pull origin $(git branch-name)"
pupl = pup --force-with-lease
# Commands for manipulating deploy tags.
# which-deploy: in which deploy did this commit first go out?
# prev-deploy and next-deploy: what deploys came before and after this one?
# when-deploy: when was this deploy completed?
which-deploy = "!f() { git tag --contains \"$@\" | grep '^gae-' | grep -v bad | head -n 1; }; f"
prev-deploy = "!f() { git tag | grep '^gae-' | grep -v bad | grep -B 1 \"$1\" | head -n 1; }; f"
next-deploy = "!f() { git tag | grep '^gae-' | grep -v bad | grep -A 1 \"$1\" | tail -n 1; }; f"
when-deploy = "!f() { git cat-file -p \"$1\" | perl -nle 'print scalar localtime $1 if /^tagger .* (\\d+) \\S+$/'; }; f"
# For after a commit fails with lint, and it says 'commit message saved...'
recommit = "!git commit -F \"`git rev-parse --git-dir`\"/commit.save"
# For getting changes made in the current week by the current user
# In order to ensure this works for Linux and OSX users, we need to cater to
# two flavors of date command:
# - The first, for OSX, uses "-v Mon" to request the date of the last monday.
# If this fails, we ignore the error and defer to...
# - The second, for Linux, uses "-d last\ monday" to request the date of the
# last monday instead.
weekly = "!git log --author=`git config user.email` --since=`date -v -Mon +%Y/%m/%d 2>/dev/null || date -d last\\ monday +%Y/%m/%d`"
# Versions of commands with useful options specified.
graph = log --graph --decorate --oneline --pretty=format:"%h%x20%Cgreen%d%x20%Cred%an%x20%Cblue%ad%x20%Creset%s" --all --full-history --date=short
ls-ignored = ls-files --exclude-standard --ignored --others
conflicts = diff --name-only --diff-filter=U
[push]
default = simple