Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
linux:git [27.04.2022 18:53. ] – django | linux:git [15.01.2023 19:16. ] (aktuell) – [Git Index] django | ||
---|---|---|---|
Zeile 493: | Zeile 493: | ||
</ | </ | ||
+ | === Kürzere Commit-Hashes === | ||
+ | Bei einigen Git Befehlen ist die Angabe des Commit-Hashes wie z.B. '' | ||
+ | $ git log --abbrev-commit | ||
+ | |||
+ | Git zeigt somit automatisch eine verkürzte siebenstellige eindeutige Länge an, die wir bei der Angabe der betreffenden Git Kommandos dann statt des vollständigen SHA1 Hashwertes verwenden können. | ||
+ | |||
+ | === kompremmierte verkürzte Git Logs === | ||
$ git log --oneline | $ git log --oneline | ||
< | < | ||
Zeile 711: | Zeile 718: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ==== Git Index ==== | ||
+ | |||
+ | <uml> | ||
+ | |||
+ | state " | ||
+ | workingtree : | ||
+ | workingtree : Lokales Arbeitsverzeichnis | ||
+ | workingtree : mit allen Verzeichnissen | ||
+ | workingtree : und Dateien - unser lokaler | ||
+ | workingtree : Arbeits- und Bearbeitungs- | ||
+ | workingtree : bereich. | ||
+ | workingtree : | ||
+ | |||
+ | state " | ||
+ | index : | ||
+ | index : Zwischenspeicher von Git, | ||
+ | index : der zwischen dem Working tree | ||
+ | index : und dem Repository steht. | ||
+ | index : Auch bekannt unter dem Namen | ||
+ | index : " | ||
+ | index : | ||
+ | |||
+ | state "Local Repository" | ||
+ | repo : | ||
+ | repo : Speicher für alle commits, | ||
+ | repo : also alle Änderungen mit | ||
+ | repo : den zugehörigen commit-Daten, | ||
+ | repo : also der vollständigen | ||
+ | repo : Versionsgeschichte. | ||
+ | repo : | ||
+ | |||
+ | state " | ||
+ | gitrepo : | ||
+ | gitrepo : remote Speicher für unser | ||
+ | gitrepo : lokales Repository umd so | ||
+ | gitrepo : mit anderen Personen oder | ||
+ | gitrepo : auf anderen Geräten das | ||
+ | gitrepo : Repository zu sharen. | ||
+ | gitrepo : | ||
+ | |||
+ | workingtree -right-> index : add | ||
+ | index -left-> workingtree : reset | ||
+ | index -right-> repo : commit | ||
+ | repo -right-> gitrepo : push | ||
+ | gitrepo -left-> repo: fetch | ||
+ | gitrepo -left-> repo: pull | ||
+ | repo -left-> workingtree : reset[commit] | ||
+ | gitrepo -left-> workingtree : pull | ||
+ | |||
+ | </ | ||
+ | |||
+ | Solange wir nicht mit einem **'' | ||
+ | |||
+ | Fragen wir nun den Status unser Umgebung ab. | ||
+ | $ git status | ||
+ | |||
+ | On branch main | ||
+ | Your branch is up to date with ' | ||
+ | | ||
+ | nothing to commit, working tree clean | ||
+ | |||
+ | Die Ausgabe **//working tree clean//** bedeutet hier nicht, dass der Index " | ||
+ | |||
+ | Was passiert nun beim Aufruf von **'' | ||
+ | $ git diff | ||
+ | |||
+ | Ist die Ausgabe " | ||
+ | $ git commit | ||
+ | |||
+ | On branch main | ||
+ | Your branch is up to date with ' | ||
+ | | ||
+ | nothing to commit, working tree clean | ||
+ | |||
+ | Mit der Option '' | ||
+ | Im Ausgangszustand, | ||
+ | |||
+ | |||
+ | |||
+ | ==== GitHub ==== | ||
+ | |||
+ | /* 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 */ | ||
+ | |||
+ | < | ||
+ | or | ||
+ | |||
+ | Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore. | ||
+ | …or create a new repository on the command line | ||
+ | |||
+ | echo "# ffmuc-offloader_rpb4" | ||
+ | git init | ||
+ | git add README.md | ||
+ | git commit -m "first commit" | ||
+ | git branch -M main | ||
+ | git remote add origin https:// | ||
+ | git push -u origin main | ||
+ | |||
+ | …or push an existing repository from the command line | ||
+ | |||
+ | git remote add origin https:// | ||
+ | git branch -M main | ||
+ | git push -u origin main | ||
+ | |||
+ | …or import code from another repository | ||
+ | |||
+ | You can initialize this repository with code from a Subversion, Mercurial, or TFS project.</ | ||
+ | |||
+ | https:// | ||
+ | |||
+ | /* | ||
+ | < | ||
+ | |||
+ | „https://< | ||
+ | |||
+ | |||
+ | In der .git/config Datei im Git Projekt Verzeichnis: | ||
+ | |||
+ | url = https:// | ||
+ | |||
+ | (unter Linux). | ||
+ | |||
+ | |||
+ | |||
+ | 1.Gehen Sie zuhttps:// | ||
+ | |||
+ | 2. Klicken Sie auf „Neuen Token generieren“ | ||
+ | |||
+ | 3. Wählen | ||
+ | |||
+ | 4. Klicken Sie auf „Token generieren“ | ||
+ | |||
+ | 5. Öffnen Sie nun auf Ihrem Computer in dem Verzeichnis, | ||
+ | |||
+ | 6. Stellen | ||
+ | |||
+ | |||
+ | 1. Das Protokoll ist „https“, | ||
+ | |||
+ | 2. Die URL enthält den Benutzernamen, | ||
+ | |||
+ | 3. Die URL enthält das soeben generierte Token | ||
+ | |||
+ | 7. Sobald | ||
+ | |||
+ | |||
+ | Quelle: andrey.mikhalchuk</ | ||
+ | */ | ||
+ | |||
+ | |||
+ | |||
+ | $ git remote add origin https:// | ||
+ | $ git branch -M main | ||
+ | $ git push -u origin main | ||
+ | < | ||
+ | Counting objects: 100% (169/169), done. | ||
+ | Delta compression using up to 8 threads | ||
+ | Compressing objects: 100% (155/155), done. | ||
+ | Writing objects: 100% (169/169), 41.24 KiB | 1.59 MiB/s, done. | ||
+ | Total 169 (delta 25), reused 0 (delta 0) | ||
+ | remote: Resolving deltas: 100% (25/25), done. | ||
+ | To https:// | ||
+ | * [new branch] | ||
+ | Branch ' | ||