-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitconfig
More file actions
63 lines (46 loc) · 2.47 KB
/
.gitconfig
File metadata and controls
63 lines (46 loc) · 2.47 KB
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
[alias]
# * Commits
c = commit -m
ac = !git add -A && git commit -m
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# * Info
# View the current working tree status using the short format
s = status -s
# Show verbose output about tags, branches or remotes
t = !"git --no-pager tag -l"
r = !"git --no-pager remote -v"
# Show the tracking branch for the current branch
tb = !"git --no-pager rev-parse --abbrev-ref --symbolic-full-name @{u}"
# Log the latest commits (default 15, pass a number to override)
l = "!f() { git --no-pager log -${1:-15} --pretty=format:'%C(green)%h %C(reset)%s %C(cyan)%an %C(brightblack)(%cr)%C(reset)'; }; f"
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD; git --no-pager diff --patch-with-stat"
# List branches sorted by last commit date (newest first)
b = "!f() { now=$(date +%s); current=$(git symbolic-ref --short HEAD 2>/dev/null); git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:unix) %(committerdate:relative)@@@%(refname:short)' | while IFS= read -r line; do ts=${line%% *}; rest=${line#* }; date=${rest%%@@@*}; branch=${rest#*@@@}; age=$(( (now - ts) / 86400 )); if [ \"$age\" -lt 7 ]; then c=32; elif [ \"$age\" -lt 30 ]; then c=33; else c=31; fi; if [ \"$branch\" = \"$current\" ]; then printf \"\\033[%sm%s\\033[0m\\t* %s\\n\" \"$c\" \"$date\" \"$branch\"; else printf \"\\033[%sm%s\\033[0m\\t %s\\n\" \"$c\" \"$date\" \"$branch\"; fi; done; }; f"
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Fetch, list, and remove local branches that have been deleted from remote.
cleanup = "!git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done"
[core]
editor = nano
# * URL shorthands
[url "git@github.com:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
[init]
defaultBranch = main
[pull]
rebase = true
[user]
name = Francisco Pitriqueo
email = franpitri@gmail.com