fdai7723
1 year ago
1 changed files with 184 additions and 0 deletions
-
184UebungSCM.md
@ -0,0 +1,184 @@ |
|||||
|
# Übung SCM |
||||
|
|
||||
|
## 1. Staging Area |
||||
|
### 1. Ornder "UebungSCM" angelegt ("mkdir UebungSCM"), mit dem Befehl "git init" ein local repository in "UebungSCM" initialisiert |
||||
|
### 2. Datei "SCM.txt" ("touch SCM.txt") in dem Ordner erstellt und mit dem Befehl "nano" folgende Textzeilen hinzugefügt: |
||||
|
> 1 |
||||
|
> 2 |
||||
|
> 3 |
||||
|
> hello |
||||
|
> world |
||||
|
> x |
||||
|
|
||||
|
### 3. Status des Repository anzeigen lassen : |
||||
|
|
||||
|
> $ git status |
||||
|
> On branch master |
||||
|
> |
||||
|
> No commits yet |
||||
|
> |
||||
|
> Untracked files: |
||||
|
> (use "git add <file>..." to include in what will be committed) |
||||
|
> SCM.txt |
||||
|
> |
||||
|
> nothing added to commit but untracked files present (use "git add" to track) |
||||
|
|
||||
|
### 4. "SCM.txt" zur git Stage hinzufügen |
||||
|
|
||||
|
> $ git add "SCM.txt" |
||||
|
> |
||||
|
|
||||
|
### 5. aktuellen Status des Repository anzeigen |
||||
|
|
||||
|
> $ git status |
||||
|
> On branch master |
||||
|
|
||||
|
> No commits yet |
||||
|
> |
||||
|
> Changes to be committed: |
||||
|
> (use "git rm --cached <file>..." to unstage) |
||||
|
> new file: SCM.txt |
||||
|
|
||||
|
### 6. Änderungen in der Datei anzeigen |
||||
|
|
||||
|
> $ git diff |
||||
|
> |
||||
|
|
||||
|
### 7. einige weitere Zeilen in "SCM.txt einfügen |
||||
|
|
||||
|
> 1 |
||||
|
> 2 |
||||
|
> 3 |
||||
|
> hello |
||||
|
> world |
||||
|
> x |
||||
|
> 5 |
||||
|
> 6 |
||||
|
> 7 |
||||
|
> 8 |
||||
|
> neun |
||||
|
> zehn |
||||
|
|
||||
|
### 8. aktuellen Status des Repository anzeigen |
||||
|
|
||||
|
> $ git status |
||||
|
> On branch master |
||||
|
> |
||||
|
> No commits yet |
||||
|
> |
||||
|
> Changes to be committed: |
||||
|
> (use "git rm --cached <file>..." to unstage) |
||||
|
> new file: SCM.txt |
||||
|
> |
||||
|
> Changes not staged for commit: |
||||
|
> (use "git add <file>..." to update what will be committed) |
||||
|
> (use "git restore <file>..." to discard changes in working directory) |
||||
|
> modified: SCM.txt |
||||
|
> |
||||
|
> |
||||
|
|
||||
|
### 9. Änderungen in der Datei anzeigen |
||||
|
|
||||
|
> $ git diff |
||||
|
> diff --git a/SCM.txt b/SCM.txt |
||||
|
> index 8c721ef..87e597b 100644 |
||||
|
> --- a/SCM.txt |
||||
|
> +++ b/SCM.txt |
||||
|
> @@ -4,3 +4,9 @@ |
||||
|
> hello |
||||
|
> world |
||||
|
> x |
||||
|
> +5 |
||||
|
> +6 |
||||
|
> +7 |
||||
|
> +8 |
||||
|
> +neun |
||||
|
> +zehn |
||||
|
> |
||||
|
> |
||||
|
|
||||
|
### 10. Einen commit erzeugen |
||||
|
|
||||
|
> $ git commit -m "SCM" |
||||
|
> [master (root-commit) 888f529] SCM |
||||
|
> 1 file changed, 6 insertions(+) |
||||
|
> create mode 100644 SCM.txt |
||||
|
> |
||||
|
|
||||
|
### 11. Commit-ID identifizieren |
||||
|
|
||||
|
> [master (root-commit) 888f529] SCM |
||||
|
|
||||
|
> $ git show 888f529 |
||||
|
> commit 888f5299d207085f201038b048e4e1a99503585f |
||||
|
|
||||
|
### 12. Zeigen sie die Änderung in der Datei an |
||||
|
|
||||
|
> $ git diff |
||||
|
> diff --git a/SCM.txt b/SCM.txt |
||||
|
> index 8c721ef..87e597b 100644 |
||||
|
> --- a/SCM.txt |
||||
|
> +++ b/SCM.txt |
||||
|
> @@ -4,3 +4,9 @@ |
||||
|
> hello |
||||
|
> world |
||||
|
> x |
||||
|
> <span style="color:green">some *+5* text</span> |
||||
|
> +6 |
||||
|
> +7 |
||||
|
> +8 |
||||
|
> +neun |
||||
|
> +zehn |
||||
|
> |
||||
|
> |
||||
|
|
||||
|
## Staging Area |
||||
|
|
||||
|
### 1. Datei auf den Stand in der Stage zurücksetzen ("git reset --hard "commit_hash") |
||||
|
|
||||
|
> $ git reset --hard 888f5299d207085f201038b048e4e1a99503585f |
||||
|
> HEAD is now at 888f529 SCM |
||||
|
> |
||||
|
|
||||
|
### 2. Aktueller Status des Repository |
||||
|
|
||||
|
> $ git status |
||||
|
> On branch master |
||||
|
> nothing to commit, working tree clean |
||||
|
> |
||||
|
|
||||
|
### 3. Änderungen in der Datei anzeigen |
||||
|
> $ git diff |
||||
|
> |
||||
|
|
||||
|
### 4. Änderungen aus der Stage entfernen ohne die Datei zurückzusetzen |
||||
|
> git checkout -- SCM.txt |
||||
|
> Updated 0 paths from the Index |
||||
|
> |
||||
|
|
||||
|
### 5. Aktueller Status des Repository |
||||
|
|
||||
|
> $ git status |
||||
|
> On branch master |
||||
|
> nothing to commit, working tree clean |
||||
|
> |
||||
|
|
||||
|
### 6. Änderungen in der Datei anzeigen |
||||
|
|
||||
|
> $ git diff |
||||
|
> |
||||
|
|
||||
|
### 7. Datei auf den Stand im commit zurücksetzen |
||||
|
|
||||
|
> $ git revert HEAD |
||||
|
> [master b4e7271] Revert "SCM" |
||||
|
> 1 file changed, 6 deletions(-) |
||||
|
> delete mode 100644 SCM.txt |
||||
|
|
||||
|
### 8. Status des Repository |
||||
|
|
||||
|
> $ git status |
||||
|
> On branch master |
||||
|
> nothing to commit, working tree clean |
||||
|
> |
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue