forked from csilvers/khan-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig.khan
63 lines (53 loc) · 3.55 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
[branch]
# autosetupmerge auto-adds the --track flag to each git branch,
# which is helpful for arc (part of Phabricator). autosetuprebase
# means that instead of merging it will rebase. Weird you need both!
autosetupmerge = always
autosetuprebase = always
[alias]
# Versions of commands that handle submodules properly.
co = "!f() { git checkout \"$@\" && 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 phabricator and 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.
phabricator-branch = !git review-branch
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
pb = !git review-branch ; short for 'phabricator branch'
# 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' --
# 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 | sed 's/gae-//'; }; f"
prev-deploy = "!f() { git tag | grep '^gae-' | grep -v bad | grep -B 1 gae-\"$1\" | head -n 1 | sed 's/gae-//'; }; f"
next-deploy = "!f() { git tag | grep '^gae-' | grep -v bad | grep -A 1 gae-\"$1\" | tail -n 1 | sed 's/gae-//'; }; f"
when-deploy = "!f() { git cat-file -p gae-\"$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
[commit]
template = ~/.git_template/commit_template
[push]
default = simple