Dieses Repository wurde erstellt für die Einsendeaufgabe zum Thema Versionierung mit Git.
Erstellen Sie sich ein Repository in Github oder GitLab.
Schritt 1
Auf GitHub ein neues Repository erstellt (https://github.com/BooleanBill/BHT-SWT-ESA-DVC).
Schritt 2
Repo lokal geklont:
git clone [email protected]:BooleanBill/BHT-SWT-ESA-DVC.git
Pushen Sie ein eigenes Projekt von Ihnen hoch (z.B. das CCD-Projekt) oder erstellen Sie ein neues Projekt!
cd ~\Projects\BHT\SWT\BHT-SWT-ESA-DVC\README.md # in das Verzeichnis wechseln
README.md erstellt und mit Markdown bearbeitet.
git add README.md # Datei hinzugefügt
git commit -m "added readme" # Commit erstellt
git push # Commit gepusht
Wenden Sie alle in den Unterlagen genannten relevanten Methoden beweisbar an: (das Github Repo ist Beweis) push, pull, add, commit, diff, status, rm/mv, etc.
git push origin task3 # Branch gepusht
git pull origin task3 # Branch gepullt
git add .\Nero.png # Bild hinzugefügt
git commit -m "Added picture of my dog Nero (Nero.png)" # Commit erstellt
git diff # Änderungen angezeigt
git diff task3 task1 # Änderungen zwischen Branches angezeigt
git status # Status angezeigt
Ausgabe
PS C:\Users\freak\Projects\BHT\SWT\BHT-SWT-ESA-DVC> git status
On branch task3
Your branch is up to date with 'origin/task3'.
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: README.md
no changes added to commit (use "git add" and/or "git commit -a")
git mv .\Nero.png .\Images\ # Bild verschoben
git rm .\Images\Nero.png # Bild gelöscht
git log # Log angezeigt
Ausgabe
PS C:\Users\freak\Projects\BHT\SWT\BHT-SWT-ESA-DVC> git log
commit 11ce1309d648decdc41fa845e8c4ab8f43539caf (HEAD -> task3, origin/task3)
Author: Martin <[email protected]>
Date: Sat Dec 30 09:32:39 2023 +0100
deleted image
commit 2454f9c546e9d1ba7f46394cf39170517f23f142
Author: Martin <[email protected]>
Date: Sat Dec 30 09:31:51 2023 +0100
moved Nero.png to Images folder, modified README.md
commit 4c84c7e787c34bdad0ae553643cad5446d466441
Author: Martin <[email protected]>
Date: Sat Dec 30 09:30:35 2023 +0100
added more steps to readme
commit 4263f6712f7c82f3ca9bf401944d199a3cb71a7d
Author: Martin <[email protected]>
Date: Sat Dec 30 09:23:17 2023 +0100
added steps to readme
commit 608ea5707ffb32565e57fe9624084a8e22b0d3be
Author: Martin <[email protected]>
Date: Sat Dec 30 09:22:08 2023 +0100
Added picture of my dog Nero (Nero.png)
commit e838563cf554f91907400750a40c6ce2a8bc9150 (origin/main, origin/klejewski-esa-dvc, origin/HEAD, main, klejewski-esa-dvc)
Author: Martin <[email protected]>
Date: Sat Dec 30 09:03:21 2023 +0100
readme for task 6
commit 96d6b26756737694414c5660043086d9d6451c42
Author: Martin Klejewski <[email protected]>
Date: Thu Dec 14 08:55:13 2023 +0100
readme added
git branch # Branches angezeigt
Ausgabe
PS C:\Users\freak\Projects\BHT\SWT\BHT-SWT-ESA-DVC> git branch
klejewski-esa-dvc
main
task1
task2
* task3
git checkout task1 # Branch gewechselt
git checkout -b task4 # Branch erstellt und gewechselt
git branch -d task5 # Branch gelöscht
git push origin --delete task5 # Branch auf remote gelöscht
git revert c0a25cafab02789cc5a2ef4eea297ce148049e37 # Commit rückgängig gemacht
git reset --hard e9659fb93eff1c94e2c6c00473c29e0e0e02a890
git push origin main --force
git reset --soft 25d334e44d69cf8dc75e69ee9f34047c93abbf26
git push origin main --force
da wir bei der Arbeit mit git flow arbeiten, füge ich hier zusätzlich noch einige der Befehle davon hinzu. Siehe dazu:
- https://datasift.github.io/gitflow/IntroducingGitFlow.html
- https://danielkummer.github.io/git-flow-cheatsheet/
git flow init # git flow initialisiert
git flow release start 1.0.0 # Release erstellt
git flow release finish 1.0.0 # Release beendet
Experimentieren Sie mit Zeitreisen!
ältere commits anzeigen
git log --pretty=oneline # alle commits anzeigen
zum älteren commit wechseln
git checkout 608ea5707ffb32565e57fe9624084a8e22b0d3be # zu einem älteren commit wechseln
Ausgabe
PS C:\Users\freak\Projects\BHT\SWT\BHT-SWT-ESA-DVC> git checkout 608ea5707ffb32565e57fe9624084a8e22b0d3be
Note: switching to '608ea5707ffb32565e57fe9624084a8e22b0d3be'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 608ea57 Added picture of my dog Nero (Nero.png)
Einweg Reise zurück in die Zeit (siehe Aufgabe 3 reset to commit (hard))
Erstellen sie zwei unterschiedliche aber ähnliche Branches, wechseln sie hin und her und mergen sie diese Branches dann wieder!
git checkout -b task4
git push --set-upstream origin task4
git checkout -b task5
git push --set-upstream origin task5
git checkout task4
git merge task5
zurück zum aktuellen Branch
git checkout task4
Erstellen Sie in GitHub einen Pull-Request bezugnehmend auf https://github.com/edlich/education! Bitte referenzieren Sie auf den Pull-Request mit Link oder der Pull-Request Nummer! Kryptische GitHub Namen kann ich kaum zuordnen. Die Aufgabenteile vor dem Pull-Request bitte nicht in den Pull-Request einbauen, sondern extra abgeben!
Schritt 1
Fork vom Repository erstellt (https://github.com/BooleanBill/education).
Schritt 2
git clone [email protected]:BooleanBill/education.git # Repository geklont
cd education # in das Verzeichnis wechseln
git checkout -b klejewski-esa-dvc # Branch erstellt
cp ~/Pictures/Nero.png ~/Projects/BHT/SWT/education/Pet-Folder # Bild kopiert
git add Pet-Folder/Nero.png # Bild hinzugefügt
git commit -m "Added picture of my dog Nero (Nero.png)" # Commit erstellt
git push origin klejewski-esa-dvc # Branch gepusht
Schritt 3
Pull-Request erstellt (edlich/education#489)