Link Search Menu Expand Document

Lösung zu Schritt 1 - Branch erstellen

Erstelle einen Branch feature-a, bearbeite die Datei foo und erstelle ein Commit. Wechsle dann zurück auf den main und bearbeite dort bar. Zeige den Commit-Graphen.

repo $ git switch -c feature-a HEAD

Switched to a new branch 'feature-a'

repo $ # Edit file foo at line 7 on branch feature-a by bjoern.


repo $ git commit -am "`foo`: Edit file foo at line 7 on branch feature-a by bjoern. "

[feature-a 300f5e9] : Edit file foo at line 7 on branch feature-a by bjoern.
1 file changed, 1 insertion(+), 1 deletion(-)
/bin/bash: line 1: foo: command not found

repo $ git switch main

Your branch is up to date with 'origin/main'.
Switched to branch 'main'

repo $ # Edit file bar at line 3 on branch main by bjoern.


repo $ git commit -am "`bar`: Edit file bar at line 3 on branch main by bjoern. "

[main b5cd7e9] : Edit file bar at line 3 on branch main by bjoern.
1 file changed, 1 insertion(+), 1 deletion(-)
/bin/bash: line 1: bar: command not found

repo $ git log --all --oneline --graph --decorate

* 300f5e9 (feature-a) : Edit file foo at line 7 on branch feature-a by bjoern.
| * b5cd7e9 (HEAD -> main) : Edit file bar at line 3 on branch main by bjoern.
|/
* 6014eb9 (origin/main) Initial edit before cloning
* de06cfe Initial edit before cloning

Lösung zu Schritt 2 - Branch mergen

Merge feature-a auf den mainund zeige den Commit-Graphen.

repo $ git merge feature-a

Merge made by the 'ort' strategy.
foo | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

repo $ git log --all --oneline --graph --decorate

* c00b978 (HEAD -> main) Merge branch 'feature-a'
|\
| * 300f5e9 (feature-a) : Edit file foo at line 7 on branch feature-a by bjoern.
* | b5cd7e9 : Edit file bar at line 3 on branch main by bjoern.
|/
* 6014eb9 (origin/main) Initial edit before cloning
* de06cfe Initial edit before cloning

Zur Aufgabe

Zum Überblick