Link Search Menu Expand Document

Lösung zu Schritt 1 - Und jetzt ein Weihnachtsbaum

Branche und Merge so, dass ˋgit log –graph –onelineˋ einen Weihnachtsbaum ausgibt.

$ git init -b main myrepo 

Initialized empty Git repository in /workspaces/git-workshop/build/git-uebungen/loesungen/weihnachten-gitmas/myrepo/.git/

$ cd myrepo


myrepo $ # created file 'hallo'


myrepo $ git add hallo


myrepo $ git commit -am "! "

[main (root-commit) 0c7fe61] !
1 file changed, 12 insertions(+)
create mode 100644 hallo

myrepo $ git switch -c b0 main

Switched to a new branch 'b0'

myrepo $ # created file 'f0'


myrepo $ git add f0


myrepo $ git commit -am "! "

[b0 92bdfa4] !
1 file changed, 12 insertions(+)
create mode 100644 f0

myrepo $ git switch -c b1 main

Switched to a new branch 'b1'

myrepo $ # created file 'f1'


myrepo $ git add f1


myrepo $ git commit -am "! "

[b1 09a0faa] !
1 file changed, 12 insertions(+)
create mode 100644 f1

myrepo $ git switch -c b2 main

Switched to a new branch 'b2'

myrepo $ # created file 'f2'


myrepo $ git add f2


myrepo $ git commit -am "! "

[b2 77ed93c] !
1 file changed, 12 insertions(+)
create mode 100644 f2

myrepo $ git switch -c b3 main

Switched to a new branch 'b3'

myrepo $ # created file 'f3'


myrepo $ git add f3


myrepo $ git commit -am "! "

[b3 1828786] !
1 file changed, 12 insertions(+)
create mode 100644 f3

myrepo $ git switch -c b4 main

Switched to a new branch 'b4'

myrepo $ # created file 'f4'


myrepo $ git add f4


myrepo $ git commit -am "! "

[b4 e044cda] !
1 file changed, 12 insertions(+)
create mode 100644 f4

myrepo $ git switch -c b5 main

Switched to a new branch 'b5'

myrepo $ # created file 'f5'


myrepo $ git add f5


myrepo $ git commit -am "! "

[b5 429f9d2] !
1 file changed, 12 insertions(+)
create mode 100644 f5

myrepo $ git switch -c b6 main

Switched to a new branch 'b6'

myrepo $ # created file 'f6'


myrepo $ git add f6


myrepo $ git commit -am "! "

[b6 9349527] !
1 file changed, 12 insertions(+)
create mode 100644 f6

myrepo $ git switch -c b7 main

Switched to a new branch 'b7'

myrepo $ # created file 'f7'


myrepo $ git add f7


myrepo $ git commit -am "! "

[b7 b6d8b78] !
1 file changed, 12 insertions(+)
create mode 100644 f7

myrepo $ git switch -c b8 main

Switched to a new branch 'b8'

myrepo $ # created file 'f8'


myrepo $ git add f8


myrepo $ git commit -am "! "

[b8 63a5a99] !
1 file changed, 12 insertions(+)
create mode 100644 f8

myrepo $ git switch -c b9 main

Switched to a new branch 'b9'

myrepo $ # created file 'f9'


myrepo $ git add f9


myrepo $ git commit -am "! "

[b9 3ae2b19] !
1 file changed, 12 insertions(+)
create mode 100644 f9

myrepo $ git switch -c b10 main

Switched to a new branch 'b10'

myrepo $ # created file 'f10'


myrepo $ git add f10


myrepo $ git commit -am "! "

[b10 3ff1aae] !
1 file changed, 12 insertions(+)
create mode 100644 f10

myrepo $ git switch b1

Switched to branch 'b1'

myrepo $ git merge --no-ff b0 -m 'year'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 f0

myrepo $ git switch b2

Switched to branch 'b2'

myrepo $ git merge --no-ff b1 -m 'new'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 f0
create mode 100644 f1

myrepo $ git switch b3

Switched to branch 'b3'

myrepo $ git merge --no-ff b2 -m 'happy'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2

myrepo $ git switch b4

Switched to branch 'b4'

myrepo $ git merge --no-ff b3 -m 'a'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
4 files changed, 48 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3

myrepo $ git switch b5

Switched to branch 'b5'

myrepo $ git merge --no-ff b4 -m 'and'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
5 files changed, 60 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4

myrepo $ git switch b6

Switched to branch 'b6'

myrepo $ git merge --no-ff b5 -m 'Christmas'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
f5 | 12 ++++++++++++
6 files changed, 72 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4
create mode 100644 f5

myrepo $ git switch b7

Switched to branch 'b7'

myrepo $ git merge --no-ff b6 -m 'merry'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
f5 | 12 ++++++++++++
f6 | 12 ++++++++++++
7 files changed, 84 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4
create mode 100644 f5
create mode 100644 f6

myrepo $ git switch b8

Switched to branch 'b8'

myrepo $ git merge --no-ff b7 -m 'a'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
f5 | 12 ++++++++++++
f6 | 12 ++++++++++++
f7 | 12 ++++++++++++
8 files changed, 96 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4
create mode 100644 f5
create mode 100644 f6
create mode 100644 f7

myrepo $ git switch b9

Switched to branch 'b9'

myrepo $ git merge --no-ff b8 -m 'you'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
f5 | 12 ++++++++++++
f6 | 12 ++++++++++++
f7 | 12 ++++++++++++
f8 | 12 ++++++++++++
9 files changed, 108 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4
create mode 100644 f5
create mode 100644 f6
create mode 100644 f7
create mode 100644 f8

myrepo $ git switch b10

Switched to branch 'b10'

myrepo $ git merge --no-ff b9 -m 'wish'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
f5 | 12 ++++++++++++
f6 | 12 ++++++++++++
f7 | 12 ++++++++++++
f8 | 12 ++++++++++++
f9 | 12 ++++++++++++
10 files changed, 120 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4
create mode 100644 f5
create mode 100644 f6
create mode 100644 f7
create mode 100644 f8
create mode 100644 f9

myrepo $ git switch main

Switched to branch 'main'

myrepo $ git merge --no-ff b10 -m 'We'

Merge made by the 'ort' strategy.
f0 | 12 ++++++++++++
f1 | 12 ++++++++++++
f10 | 12 ++++++++++++
f2 | 12 ++++++++++++
f3 | 12 ++++++++++++
f4 | 12 ++++++++++++
f5 | 12 ++++++++++++
f6 | 12 ++++++++++++
f7 | 12 ++++++++++++
f8 | 12 ++++++++++++
f9 | 12 ++++++++++++
11 files changed, 132 insertions(+)
create mode 100644 f0
create mode 100644 f1
create mode 100644 f10
create mode 100644 f2
create mode 100644 f3
create mode 100644 f4
create mode 100644 f5
create mode 100644 f6
create mode 100644 f7
create mode 100644 f8
create mode 100644 f9

Merry GITmas

myrepo $ git log --all --oneline --topo-order --graph -12 main

* 529f0a7 We
|\
| * 284b561 wish
| |\
| | * 2cf3fe2 you
| | |\
| | | * 0a0ac72 a
| | | |\
| | | | * 3a5c254 merry
| | | | |\
| | | | | * 852c32d Christmas
| | | | | |\
| | | | | | * 80f41ba and
| | | | | | |\
| | | | | | | * fc0d499 a
| | | | | | | |\
| | | | | | | | * 8f370b1 happy
| | | | | | | | |\
| | | | | | | | | * 2adf7c5 new
| | | | | | | | | |\
| | | | | | | | | | * 8795cf6 year
| | | | | | | | | | |\
| | | | | | | | | | | * 92bdfa4 !
| |_|_|_|_|_|_|_|_|_|/
|/| | | | | | | | | |

myrepo $ cd ..


Zur Aufgabe

Zum Überblick