Solution to Step 0 - START

Solution to Step 1 - Navigation in exercise directories

(from the unzipped zip file)

Navigate to the subdirectory aufgaben/intro-commandline/hallo and look at the content of the file located there. Use tab completion to avoid typing so much. Then navigate back to the parent directory intro-commandline.

git-uebungen $ ls

aufgaben aufgaben.json loesungen ueberblick.html ueberblick.md

git-uebungen $ cd aufgaben


aufgaben $ cd intro-commandline


intro-commandline $ cd hallo


hallo $ ls

herzlich-willkommen.txt

hallo $ cd ..


Solution to Step 2 - Check Git version

Print which version of Git is installed.

$ git version

git version 2.50.1

Solution to Step 3 - Help

Show the help page for the log command.

$ git help log

GIT-LOG(1) Git Manual GIT-LOG(1)

NAME
git-log - Show commit logs
...

Solution to Step 4 - less and long outputs

When you run git log, 99 commits should be displayed. Because this does not fit in a terminal window, the less viewer is opened. Close it. Then use less some-file.txt to view a file in less mode.

repo $ git log

commit 5e14e1dc688e7a2cd02c9ccad3dedf397d407e2e (HEAD -> main)
Author: bjoern <kapitel26blog@gmail.com>
Date: Thu Jul 29 00:00:00 2021 +0000

: Edit file some-file.txt at line 3 on branch main by bjoern.

commit 41984e9ac879b9b56c8e91228a8d5887bca228fd
Author: bjoern <kapitel26blog@gmail.com>
Date: Thu Jul 29 00:00:00 2021 +0000

: Edit file some-file.txt at line 3 on branch main by bjoern.

commit 99399d263ccc8fe4a1bc59a49c93147b17115518
Author: bjoern <kapitel26blog@gmail.com>
Date: Thu Jul 29 00:00:00 2021 +0000

: Edit file some-file.txt at line 3 on branch main by bjoern.

commit df80cb240781a015f2f0ad62a48fc42964fdfe8b
Author: bjoern <kapitel26blog@gmail.com>
Date: Thu Jul 29 00:00:00 2021 +0000

: Edit file some-file.txt at line 3 on branch main by bjoern.
:

Quit with q

repo $ less some-file.txt

Editet in Commit 99
line 1 created
line 2 created
line 3 created
line 4 created
line 5 created
line 6 created
line 7 created
line 8 created
line 9 created
line 10 created
line 11 created

Quit with q

Solution to Step 5 - Configure Git

Check the user configuration:

$ git config user.name
$ git config user.email
$ git config pull.rebase
$ git config merge.conflictStyle
$ git config --global init.defaultBranch

Configure your username and email, if not already set:

$ git config --global user.name my-name
$ git config --global user.email my-email

The following configurations were used when recording the sample solution. It is recommended to set them for this workshop:

$ git config --global pull.rebase false
$ git config --global merge.conflictStyle diff3
$ git config --global init.defaultBranch main
repo $ git config --global user.name mein-name


repo $ git config --global user.email meine-email


repo $ git config --global pull.rebase false 


repo $ git config --global merge.conflictStyle diff3


repo $ git config --global init.defaultBranch main


Solution to Step 6 - ⭐ History

Press the 🡅 key several times and then press enter, to execute one of the previous commands again. Type ctrl+r and then enter conflict, to re-run the command to set merge.conflictStyle.

repo $ git config --global user.email meine-email


repo $ git config --global merge.conflictStyle diff3


Solution to Step 7 - ⭐ Configure Git editor

Configure an editor for git. Tips on this.f Then test with git config -e to see if it worked.

repo $ git config --global core.editor notepad


repo $ git config -e


Solution to Step 8 - ⭐ Working directory

Print out which working directory you are currently in. For Windows users: also test the command with the -W option.

repo $ pwd

/workspaces/git-workshop/build/git-uebungen-en/loesungen/intro-commandline/repo

Solution to Step 9 - ⭐ Open applications

Open the file some-file.txt with the default application. Open a file explorer in the current working directory.

repo $ start some-file.txt


repo $ start .


To the exercise

To the overview