-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
81 lines (67 loc) · 2.47 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
## ~/.gitconfig: global git configuration
[user]
name = microsounds
email = microsounds@users.noreply.github.com
[alias]
# outline commits made before HEAD
summary = past
past = log --graph -n 16 \
--pretty=format:'%C(cyan)%h%C(auto)%d %s %C(yellow)%ar'
# outline commits made after HEAD
future = "!f() { \
{ git log --graph --color=always \
--pretty=format:'%C(cyan)%h%C(auto)%d %s %C(yellow)%ar' \
HEAD~1..master; printf '\n'; } | tail -n 17; \
}; f"
# step back and forth in repo
# ff moves toward master by default, specify commit-ref to follow that instead
rw = checkout HEAD~1
ff = "!f() { \
towards="${1:-master}"; \
git checkout $(git rev-list --date-order HEAD..$towards | tail -n 1); \
}; f"
# home directory version control
meta = !git --git-dir=$HOME/.config/meta --work-tree=$HOME
# list all tracked filenames in repo, for use with xargs
list-files = ls-tree -r HEAD --name-only --full-tree
# interactive file tree for tracked files, opens with $EDITOR in new window
# accepts optional query argument, excludes binary files from tree listing
edit-tree = "!f() { \
while :; do \
unset prefix file; \
prefix="$(git rev-parse --show-toplevel)"; \
[ ! -z "$prefix" ] && cd "$prefix" || exit; \
file="$(git list-files | xargs grep -Il '' \
| fzf -1 -0 --no-multi --layout=reverse ${1:+-q "$1"} \
--prompt="\\[$(path-gitstatus -p)\\]:\\ " )"; \
[ ! -z "$file" ] && visual ${EDITOR%-R} "$prefix/$file" || exit; \
done; \
}; f"
# squash fixups
flatten = !GIT_SEQUENCE_EDITOR=true git rebase -i --root
# make last second changes to previous commit
recommit = "!f() { git add -u; git commit --amend; }; f"
# automated stage, commit and push for use in scripts
checkin = "!f() { \
! is-container && who=\"$(whoami)@$(uname -n)\" || who='CI'; \
change=\"$(git status --porcelain | wc -l) change\"; \
case "$change" in '1 '*) ;; *) change=\"${change}s\";; esac; \
git commit -a -m \"[$who] $change $(date '+%Y/%-m/%-d %-I:%M%P %Z')\"; \
}; f"
shove = "!f() { git checkin; git push; }; f"
# size reporting functions in kilobytes
# find size of worktree in HEAD
size-tree = !echo $(( ($(git list-files | xargs -I '{}' ls -l '{}' \
| tr -s ' ' '\t' | cut -f5 | paste -s -d '+')) / 1024 ))
# find size of compressed git repo
size-pack = !git count-objects -v \
| fgrep 'size-pack' | tr -s ' :' '\t' | cut -f2
[init]
defaultBranch = master
[pull]
ff = only
[advice]
detachedHead = false
[rebase]
autoStash = true
autoSquash = true