-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgitconfig.txt
135 lines (108 loc) · 3.49 KB
/
gitconfig.txt
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
[color]
ui = true
[core]
editor = nano
# pager = diff-so-fancy | less --tabs=4 -RFX
[delta]
features = decorations
whitespace-error-style = 22 reverse
[delta "decorations"]
plus-style = syntax
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
[url "https://github.com/"]
insteadOf = github:
[url "https://github.com/"]
insteadOf = github-dev:
[url "git@github.com:"]
pushInsteadOf = github-dev:
[url "https://github.com/patrickelectric/"]
insteadOf = eu:
[url "git@github.com:patrickelectric/"]
pushInsteadOf = eu:
[url "https://github.com/bluerobotics/"]
insteadOf = blue:
[url "https://anongit.kde.org/"]
insteadOf = kde:
[url "git@git.kde.org:"]
pushInsteadOf = kde:
[alias]
# Avoid git git commands
git = !git
# I have problems
ck = checkout
# Create a branch from a github remote, using the PR number and the remote name
# git pr remote_name pr_number branch_name extra_args
pr = "!f() { \
BRANCH=${3:-\"pr_$2\"}; \
git fetch $1 pull/$2/head:$BRANCH; \
git checkout $BRANCH; \
git log master..$BRANCH --oneline; \
}; f"
# Commit each file in a commit with $file_without_extension: $1
# git commit-each-file "my message"
commit-each-file = "!f() { \
for i in $(git ls-files -m); do \
git add \"$i\"; \
FILE=$(basename -- $i); \
git commit -sm \"${FILE%.*}: $1\"; \
done \
}; f"
# git cry origin/master
cry = "!f() { \
git absorb --base $1; \
git -c core.editor=true rebase -i --autostash $1; \
}; f"
# git cloneorg org
cloneorg = "!f() { \
ORG_URL=\"https://api.github.com/orgs/$1/repos?per_page=200\"; \
ALL_REPOS=$(curl -s ${ORG_URL} | grep html_url | awk 'NR%2 == 0' | cut -d ':' -f 2-3 | tr -d '\",\"'); \
for ORG_REPO in ${ALL_REPOS}; do git clone ${ORG_REPO}.git; done; \
}; f"
# List branchs by age
branch-by-age = for-each-ref --sort=committerdate refs/heads/ --format='%(authordate) \t %(refname:short)'
# git fix-old number
# Will apply a fixup in the n-old commit
fix-old = "!f() { git commit --fixup=$(git rev-parse HEAD~$(($1-1))); }; f"
# git update
# Save branch with name-time and get the new branch from origin with the same name
update = "!f() { \
NAME=$(git symbolic-ref --short HEAD); \
TIME=$(git log -1 --date=format:"%Y-%m-%d-%H-%M-%S" --format=%ad); \
NEW_NAME=$NAME-$TIME; \
git branch -m $NAME-$TIME; \
git checkout $NAME; \
echo "Saving old branch as $NEW_NAME"; \
}; f"
# git contributions
contributions = shortlog -sne
stats = "!f() { \
status=$(git status --porcelain); \
IFS=$'\\n'; \
for line in $status; do \
file=${line:3}; \
case ${line:0:2} in \
\" M\") \
echo -e \"\\e[31m $file\\e[0m\" \
;; \
\"M \") \
echo -e \"\\e[32m $file\\e[0m\" \
;; \
\"??\") \
echo -e \"\\e[33m $file\\e[0m\" \
;; \
esac; \
done; \
}; f"
# git apply-from-url URL (with or without.patch) to apply in current
apply-from-url = "!f() { url=$1; if [[ ! $url =~ .patch$ ]]; then url="$url.patch"; fi; curl -sL $url | git apply -; }; f"
[user]
email = patrickelectric@gmail.com
name = Patrick José Pereira
[rebase]
autosquash = true
[tig]
diff-highlight = false
[credential]
helper = cache --timeout 7200