-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
80 lines (74 loc) · 1.64 KB
/
Makefile
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
# Run all these commands with the `-s` flag.
# Prints the status of all unclean repositories.
status:
for dir in */; do \
if [ -d $$dir/.git ]; then \
cd $$dir; \
if [[ ! -z `git st` ]]; then \
echo $$dir; \
git st; \
fi; \
cd ..; \
fi \
done
# Checks whether any repositories have unpushed commits.
#
# If you get errors like "fatal: No upstream configured for branch '<branch>'",
# then you must `git push -u origin`.
ahead:
for dir in */; do \
if [ -d $$dir/.git ]; then \
cd $$dir; \
if [[ ! -z `git remote` ]] && [[ ! -z `git rev-list @{u}..` ]]; then \
echo $$dir; \
git rev-list @{u}..; \
fi; \
cd ..; \
fi \
done
# Prints a repository's branch if it's not the default branch.
branch:
for dir in */; do \
if [ -d $$dir/.git ]; then \
cd $$dir; \
if [[ `git branch` != "* main" ]] && [[ `git branch` != "* master" ]] && [[ `git branch` != "* latest" ]]; then \
echo $$dir; \
git branch; \
fi; \
cd ..; \
fi \
done
# Prints a repository's stashes.
stash:
for dir in */; do \
if [ -d $$dir/.git ]; then \
cd $$dir; \
if [[ ! -z `git stash list` ]]; then \
echo $$dir; \
git stash list; \
fi; \
cd ..; \
fi \
done
# Makes a commit on each repository.
commit:
for dir in */; do \
if [ -d $$dir/.git ]; then \
echo $$dir; \
cd $$dir; \
git commit -q ${ARGS}; \
cd ..; \
fi \
done
# Pushes all repositories with unpushed commits.
push:
for dir in */; do \
if [ -d $$dir/.git ]; then \
cd $$dir; \
if [[ ! -z `git remote` ]] && [[ ! -z `git rev-list @{u}..` ]]; then \
echo $$dir; \
git -q push; \
fi; \
cd ..; \
fi \
done