Skip to content

Commit e47e5e6

Browse files
committed
Update illustrations
1 parent 469e662 commit e47e5e6

File tree

7 files changed

+148
-1
lines changed

7 files changed

+148
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This is a shortcut to `git log --graph` which provides a middle ground between
99
showing _only a given branch_ (which might lack context) and showing _all_ branches
1010
(which might get crowded on big projects).
1111

12-
| `git log --graph` | `git log --graph --all` |
12+
| `git log --graph --oneline` | `git log --graph --oneline --all` |
1313
|:------------------------------------------------:|:---------------------------------------------------:|
1414
| ![git log --graph](doc/git-log-graph-single.png) | ![git log --graph --all](doc/git-log-graph-all.png) |
1515

doc/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test-repo
2+
test-remote

doc/example.sh

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#!/usr/bin/env bash
2+
3+
commit() {
4+
git commit --allow-empty -m "$1"
5+
}
6+
7+
git_sha() {
8+
git log --all --oneline | grep "$1" | head -n 1 | cut -d ' ' -f 1
9+
}
10+
11+
reset_to() {
12+
git reset --hard "$(git_sha "$1")"
13+
}
14+
15+
16+
init_repos() {
17+
18+
rm -rf ./test-remote ./test-repo
19+
20+
[[ ! -d test-remote ]] && {
21+
mkdir test-remote && cd test-remote && git init --bare -b main
22+
cd ..
23+
}
24+
[[ ! -d test-repo ]] && {
25+
mkdir test-repo && cd test-repo && git init -b main
26+
git remote add origin ../test-remote
27+
cd ..
28+
}
29+
30+
cd test-repo || exit 1
31+
32+
git switch main
33+
commit "Initial commit"
34+
commit "Main Commit 1"
35+
commit "Main Commit 2"
36+
commit "Main Commit 3"
37+
commit "Main Commit 4"
38+
commit "Main Commit 5"
39+
git push --force origin main
40+
41+
git branch -f feature-1
42+
git switch feature-1
43+
reset_to "Main Commit 5"
44+
commit "Feature 1 - Commit 1"
45+
commit "Feature 1 - Commit 2"
46+
commit "Feature 1 - Commit 3"
47+
commit "Feature 1 - Commit 4"
48+
git push --force origin feature-1
49+
reset_to "Feature 1 - Commit 3"
50+
51+
git branch -f feature-1b
52+
git switch feature-1b
53+
reset_to "Feature 1 - Commit 4"
54+
commit "Feature 1b - Commit 1"
55+
commit "Feature 1b - Commit 2"
56+
git push --force origin feature-1b
57+
58+
git switch main
59+
commit "Main Commit 6"
60+
git push --force origin main
61+
62+
git branch -f feature-2
63+
git switch feature-2
64+
reset_to "Main Commit 6"
65+
commit "Feature 2 - Commit 1"
66+
commit "Feature 2 - Commit 2"
67+
commit "Feature 2 - Commit 3b"
68+
git push --force origin feature-2
69+
70+
git switch main
71+
reset_to "Main Commit 6"
72+
commit "Main Commit 7"
73+
git push --force origin main
74+
reset_to "Main Commit 6"
75+
76+
git branch -f feature-3
77+
git switch feature-3
78+
reset_to "Main Commit 5"
79+
commit "Feature 3 - Commit 1"
80+
commit "Feature 3 - Commit 2"
81+
git push --force origin feature-3
82+
83+
git branch -f feature-4
84+
git switch feature-4
85+
reset_to "Main Commit 6"
86+
87+
commit "Feature 4 - Commit 1"
88+
commit "Feature 4 - Commit 2"
89+
commit "Feature 4 - Commit 3"
90+
git push --force origin feature-4
91+
92+
git switch feature-2
93+
reset_to "Feature 2 - Commit 2"
94+
commit "Feature 2 - Commit 3"
95+
commit "Feature 2 - Commit 4"
96+
97+
git branch -f feature-5
98+
git switch feature-5
99+
reset_to "Main Commit 7"
100+
101+
commit "Feature 5 - Commit 1"
102+
commit "Feature 5 - Commit 2"
103+
commit "Feature 5 - Commit 3"
104+
git push --force origin feature-5
105+
106+
git branch -f feature-6
107+
git switch feature-6
108+
reset_to "Main Commit 7"
109+
110+
commit "Feature 6 - Commit 1"
111+
commit "Feature 6 - Commit 2"
112+
git push --force origin feature-6
113+
114+
git switch feature-2
115+
116+
git branch -D feature-3
117+
git branch -D feature-4
118+
git branch -D feature-5
119+
git branch -D feature-6
120+
git branch -D feature-1b
121+
122+
cd ..
123+
}
124+
125+
init_repos > /dev/null 2>&1
126+
127+
cd test-repo || exit 1
128+
129+
echo
130+
echo "## git log --graph --oneline ##########################"
131+
echo
132+
git log --graph --oneline
133+
echo
134+
echo "## git log --graph --oneline --all ####################"
135+
echo
136+
git log --graph --oneline --all
137+
echo
138+
echo "## git context-graph ##################################"
139+
echo
140+
git context-graph
141+
echo
142+
143+
cd ..
144+
[[ -d ./test-remote ]] && rm -rf ./test-remote
145+
[[ -d ./test-repo ]] && rm -rf ./test-repo

doc/git-context-graph-large.png

39.8 KB
Loading

doc/git-context-graph.png

-6.95 KB
Loading

doc/git-log-graph-all.png

143 KB
Loading

doc/git-log-graph-single.png

52.4 KB
Loading

0 commit comments

Comments
 (0)