-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
80 lines (79 loc) · 3.03 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
[color]
ui = auto
[user]
name =
email =
[core]
excludesFile = ~/.gitignore_global
autocrlf = false
quotepath = false
pager = ""
[pager]
log = less
diff = less
[http]
sslVerify = false
[credential]
helper = cache
[alias]
co = checkout
ci = commit
st = status --short --branch
br = branch
hist = log --pretty=format:\"%h %C(red reverse)%ad%Creset %C(green reverse)%an%Creset \t| %s%d\" --graph --date=short --name-status
# Show local branches sorted by date
br-date = "!f () { (for i in `git branch | colrm 1 2`; do echo `git log --date=iso8601 -n 1 --pretty=\"format:[%ai] %h\" $i` $i ; done) | sort -r; };f"
# Show all branches (including remote) sorted by date
br-date-all = "!f () { (for i in `git branch -a | colrm 1 2`; do echo `git log --date=iso8601 -n 1 --pretty=\"format:[%ai] %h\" $i` $i ; done) | sort -r; };f"
# Add kyawawa's remote repository (Github Only)
remote-add-kyawawa = "!f () {\
prefix=$(echo $(git remote -v | grep origin$'\t' | head -n 1 | cut -f2 | cut -f1 -d \" \") | cut -f1 -d@ | cut -f1 -d:); \
if [ \"$prefix\" = \"https\" ];then \
prefix=https://github.com/; \
else \
fi; \
suffix=$(echo https://github.com/start-jsk/rtmros_common.git | rev | cut -f1 -d/ | rev); \
git remote add kyawawa ${prefix}kyawawa/${suffix}; \
};f"
# Remove all deleted items
rm-all = "!f () { git rm `git ls-files --deleted`; };f"
# Remove Sumbodules
smrm = "!f () {\
if [ $# -ne 1 ];then \
echo \"Usage: git smrm path/to/submodule\";\
exit;\
fi;\
sm=${1%/};\
echo git config --remove-section submodule.${sm};\
git config --remove-section submodule.${sm};\
echo git config --file .gitmodules --remove-section submodule.${sm};\
git config --file .gitmodules --remove-section submodule.${sm};\
echo git rm --cached ${sm};\
git rm --cached ${sm};\
gitdir=./;\
gitfile=.git;\
while : ;do \
if [ -f $gitfile ];then \
gitfile=${gitdir}/$(awk '/gitdir/ {print $2}' ${gitfile});\
else \
gitdir=${gitfile};\
break;\
fi;\
done;\
if [ -n \"${gitdir}\" ];then \
echo rm -rf ${gitdir}/modules/${sm};\
rm -rf ${gitdir}/modules/${sm};\
fi;\
echo rm -rf ${sm};\
rm -rf ${sm};\
};f"
# port = "!f () {\
# date=`date \"+%Y%m%d-%H%M%S\"`;\
# branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p');\
# echo $branch;\
# host=`hostname -s`;\
# git checkout -b \"wip-${date}\";\
# git add -A;\
# git commit -m \"[WIP] temporary commit from ${branch} on ${host}\";\
# };f"