Solution to Step 0 - START
Solution to Step 1 - Create branch
Create a branch feature-a
, edit the file foo
and create a commit. Then switch back to main
and edit bar
there. Show the commit graph.
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
Solution to Step 2 - Merge branch
Merge feature-a
into main
and show the commit graph.
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