-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgitconfig
More file actions
101 lines (90 loc) · 3.53 KB
/
gitconfig
File metadata and controls
101 lines (90 loc) · 3.53 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
[user]
name = ctadel
email = nep.prajwal@gmail.com
[merge]
tool = vimdiff
conflictStyle = diff3
[push]
default = upstream
[fetch]
recurseSubmodules = on-demand
prune = true
[rebase]
autosquash = true
[pull]
rebase = true
[credential "https://github.com"]
helper = !/usr/bin/gh auth git-credential
[credential "https://gist.github.com"]
helper = !/usr/bin/gh auth git-credential
[includeIf "gitdir:/home/prajwal/ttn/lakeshore/"]
path = /home/prajwal/ttn/lakeshore/.gitconfig
[alias]
history = "!f() { \
if [ \"$#\" -eq 0 ]; then \
echo \"Custom git alias\"; \
echo \"Usage: git history <file1> [file2 ...]\"; \
return 1; \
fi; \
for file in \"$@\"; do \
git log --follow --format=%H \"$file\" | while read -r commit; do \
git show --color=always \"$commit\" -- \"$file\"; \
done; \
done | less -R; \
}; f"
backup = "!f() { \
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \
echo '❌ Not inside a Git repository.'; \
exit 1; \
fi; \
OUT=\"${1:-git-backup-$(date +%Y%m%d-%H%M%S).zip}\"; \
git ls-files --others --cached --exclude-standard -z | \
grep -zvE '\\.gitignore|\\.dockerignore' | \
xargs -0 zip -r \"$OUT\" > /dev/null; \
echo \"✔ Backup created at $OUT\"; \
}; f"
quicksave = "!f() { \
if ! git rev-parse --git-dir > /dev/null 2>&1; then echo 'Not a git repository'; exit 1; fi; \
label=\"${1:-}\"; \
timestamp=$(date +%Y%m%d-%H%M%S); \
if [ -n \"$label\" ]; then \
msg=\"__QuickSave__[$timestamp] $label\"; \
else \
msg=\"__QuickSave__[$timestamp]\"; \
fi; \
git stash push -u -m \"$msg\" && echo \"QuickSaved: $msg\"; \
}; f"
quicksee = "!f() { \
if ! git rev-parse --git-dir > /dev/null 2>&1; then echo 'Not a git repository'; exit 1; fi; \
label=\"\"; \
if [ $# -ge 1 ]; then \
case \"$1\" in \
-*) ;; \
*) label=\"$1\"; shift ;; \
esac; \
fi; \
if [ -n \"$label\" ]; then \
stash=$(git stash list --format='%gd %gs' | grep \"__QuickSave__.*$label\" | head -1 | awk '{print $1}'); \
if [ -z \"$stash\" ]; then echo 'No matching QuickSave found for label:' \"$label\"; exit 1; fi; \
else \
stash=$(git stash list --format='%gd %gs' | grep '__QuickSave__' | head -1 | awk '{print $1}'); \
if [ -z \"$stash\" ]; then echo 'No QuickSave found.'; exit 1; fi; \
fi; \
git stash show \"$stash\" \"$@\"; \
}; f"
quickapply = "!f() { \
if ! git rev-parse --git-dir > /dev/null 2>&1; then echo 'Not a git repository'; exit 1; fi; \
label=\"${1:-}\"; \
if ! git diff --quiet --ignore-submodules; then \
read -p 'You have unstaged changes. Save them before applying QuickSave? (yes/no): ' ans; \
case \"$ans\" in y|Y|yes|YES) git stash push -u ;; *) git reset --hard ;; esac; \
fi; \
if [ -n \"$label\" ]; then \
stash=$(git stash list --format='%gd %gs' | grep \"__QuickSave__.*$label\" | head -1 | awk '{print $1}'); \
if [ -z \"$stash\" ]; then echo 'No matching QuickSave found for label:' \"$label\"; exit 1; fi; \
else \
stash=$(git stash list --format='%gd %gs' | grep '__QuickSave__' | head -1 | awk '{print $1}'); \
if [ -z \"$stash\" ]; then echo 'No QuickSave found.'; exit 1; fi; \
fi; \
git stash apply \"$stash\" && echo \"Applied QuickSave: $stash\"; \
}; f"