-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig_global
80 lines (78 loc) · 2.76 KB
/
gitconfig_global
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
[user]
name = David Goldstein
[credential]
helper = cache --timeout=2600000
[merge]
ff = only
conflictstyle = diff3
[color]
ui = true
[core]
editor = vim
[format]
# show the commit date instead of the author date. This is the date of the rebase / amend
# instead of the first time it was commited.
pretty = format:"%C(auto,yellow)commit %C(auto)%H%d\nAuthor: %an <%ae>\nDate: %cd\n\n%w(0,4,4)%B"
[log]
# always use local timezone
date = local
[push]
default = simple
[branch]
# don't set up upstreams automatically, github cli doesn't like it
autoSetupMerge = false
[status]
submoduleSummary = true
[diff]
submodule = log
[alias]
view = log --graph --oneline --decorate --boundary --all HEAD
bopen = "!f() { git checkout origin/master -b $1 && git commit -a;}; f"
st = status
branches = branch
# get the name of the current branch. Useful for other aliases.
branch-name = "!git rev-parse --abbrev-ref HEAD"
bdiff = diff origin/master...HEAD
stash-unstaged = stash -k -u # stashes unstaged and untracked files
# update maaster and merge into current branch
mergemaster = "!git pullmaster && git merge origin/master --no-ff"
# update master & rebase current branch onto it
remaster = "\
!doremaster() {\
local curbranch=\"$(git branch-name)\";\
echo \"remastering branch ${curbranch}\";\
git pullmaster &&\
git rebase master && echo \"rebased onto master\";\
}; doremaster"
pullmaster = "\
!bash -c 'dopullmaster() {\n\
local curbranch=\"$(git branch-name)\";\n\
if [ \"${curbranch}\" == 'master' ]; then\n\
git pull origin master;\n\
else\n\
echo \"fetching master\";\n\
git fetch origin master;\n\
local RET=$?;\
(git merge-base --is-ancestor master origin/master && \n\
echo \"updating master\" && git branch -f master origin/master)|| \n\
echo \"not updating master because it is not an ancestor of origin/master\";\n\
return $RET;\
fi\n\
}; dopullmaster'"
# Unstage all files that have been added to the staging area
unstage = reset HEAD
# remove a file from git but don't delete it locally
forget = rm --cached
trash-local = reset --hard HEAD
prune = fetch --prune
squash = "!git reset --soft $1 && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\""
stash-all = stash save --include-untracked
compare = "\
!docompare() {\
git merge-base --is-ancestor $1 $2 && echo \"$1 is an ancestor of $2\";\
git merge-base --is-ancestor $2 $1 && echo \"$2 is an ancestor of $1\";\
}; docompare"
cleanup = "!bash -c 'cleanup() {\n\
local top=\"$(git rev-parse --show-toplevel)\";\n\
sudo rm -rf $(ls -h \"$top/.git/objects/pack/tmp_pack*\");\n\
}; cleanup'"