git_gitea

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Nächste ÜberarbeitungBeide Seiten der Revision
git_gitea [01/10/2022 - 10:26] – gelöscht - Externe Bearbeitung (Unknown date) 127.0.0.1git_gitea [03/10/2022 - 07:19] thommie4
Zeile 1: Zeile 1:
 +====== GIT und GITHUB Basisdoku ======
 +
 +  * [[https://rogerdudler.github.io/git-guide/index.de.html|https://rogerdudler.github.io/git-guide/index.de.html]]
 +  * [[https://git-scm.com/docs/everyday|https]][[https://git-scm.com/docs/everyday|://git-scm.com/docs/everyday ]]
 +  * [[https://github.com/yui/yui3/wiki/Set-Up-Your-Git-Environment|https://github.com/yui/yui3/wiki/Set-Up-Your-Git-Environment ]]
 +  * [[https://www.thomas-krenn.com/de/wiki/Git_Grundbefehle|https://www.thomas-krenn.com/de/wiki/Git_Grundbefehle]]
 +
 +===== GIT =====
 +
 +==== Basisfunktionen & lokale Instanz ====
 +
 +  - Arbeitskopie = die echten Dateien, dynamisch
 +  - ''git add''  addiert den aktuellen Datenstand in den Index ("Stage")
 +  - HEAD zeigt immer auf letzten Commit. Ein ''git commit -m "Commit-Nachricht"''  übernimmt den Status nach HEAD. 
 +
 +Initialisierung: leeres Repository erzeugen und die darin vorhandenen Dateien in den lokalen git Index aufnehmen
 +
 +<code>
 +git init
 +git add .
 +</code>
 +
 +Danach initialer Commit, um den aktuellen Stand im HEAD aufzunehmen
 +
 +''git commit -m "Commit-Nachricht"''
 +
 +
 +==== Remote Repos: Verknüpfen einer lokalen Instanz mit Github ====
 +
 +**Kontrolle der Remote Ziele "origin" und "upstream"**
 +
 +<code>
 +git remote -v
 +
 +origin  git@github.com:thommierother/docs.git (fetch)
 +origin  git@github.com:thommierother/docs.git (push)
 +upstream        git@github.com:owncloud/docs.git (fetch)
 +upstream        git@github.com:owncloud/docs.git (push)
 +</code>
 +
 +Nach dem Anlegen eines eigenen Repos auf github kann man das lokale Repo mit einem Repo auf github verknüpfen.
 +
 +  * origin = persönliches git Repo auf Github. Die kann ein privater Fork eines öffentlichen Repos auf github sein.
 +
 +Anders bei öffentlichen Repos: Öffentliche Repos werden zunächst geforkt, also eine Kopie im eigenen Repo-Speicher als "origin" angelegt. Lokale Änderungen werden zuerst nach origin übertragen. Danach werden sie per pull request (PR) zur Übernahme nach  upstream "angemeldet".
 +
 +  * upstream = öffentliches Github Repo (z.B. [[https://github.com/owncloud/core|https://github.com/owncloud/core]]). 
 +
 +Lokale Instanz: hinzufügen des entfernten "origin"
 +
 +<code>
 +git remote add origin git@github.com:thommierother/oc-theme-nw2.git 
 +git push -u origin master
 +</code>
 +
 +Analog geht das Verbinden des öffentlichen Repos als "upstream":
 +
 +<code>
 +git remote add upstream ''git@github.com:https://github.com/owncloud/docs.git''
 +</code>
 +
 +==== Synchronisation lokales Repo mit entfernten ====
 +
 +**pushen**
 +
 +''git push origin''  Änderungen auf das eigene Repo oder auf den Fork **senden**
 +
 +''git push upstream ''Änderungen nach upstream **senden**
 +
 +**abholen**
 +
 +''git fetch origin''  Änderungen vom eigenen Repo oder vom Fork eines öffentlichen Repos abholen
 +
 +''git fetch upstream ''Änderungen von upstream abholen
 +
 +
 +===== Github: entferntes Repo klonen =====
 +
 +Lokale Kopie des aktuellen Arbeitsstandes auf github anlegen
 +
 +''git clone /pfad/zum/''''repository''
 +
 +''git commit -m "Commit-Nachricht''  Änderungen hochladen
 +
 +====== Update des Fork auf Github ======
 +
 +Das geht über das **lokale**  Repo:
 +
 +Updates von Upstream holen
 +
 +<code>''$ git fetch upstream''
 +
 +</code>
 +
 +Zum master bzw. main wechseln
 +
 +<code>''git checkout master''
 +
 +</code>
 +
 +Master mit upstream mergen
 +
 +<code>''git merge upstream/master''
 +
 +</code>
 +
 +Danach push auf den fork setzen.
 +
 +===== Branches =====
 +
 +Wo bin ich (aktueller Branch)
 +
 +<file>
 +git show branch
 +</file>
 +
 +Alle Branches im Repo zeigen
 +
 +<code>
 +git branch -a
 +
 +  main
 +* master
 +  remotes/origin/HEAD -> origin/main
 +  remotes/origin/main
 +  remotes/origin/master
 +</code>
 +
 +Zum anderen Branch wechseln
 +
 +<code>
 +git checkout master
 +</code>
 +
 +Freier Wechsel zu Branch
 +
 +''git checkout [branchname]''
 +
 +Lokal erzeugten Branch im remote Repo verfügbar machen
 +
 +''git push origin master ''
 +
 +synchronisiert in den Master Branch vom Remote Repo (origin)."origin" weist auf den (privaten) Fork eines Github-zentralen Repos.
 +
 +Neuen Branch erstellen und zu diesem wechseln
 +
 +''git checkout -b feature_x''
 +
 +Branch löschen
 +
 +''git branch -d feature_x''
 +
 +Download eines Branch (vmware-host-modules)
 +
 +''git checkout -b workstation-16.2.1 origin/workstation-16.2.1''
 +
 +danach 
 +
 +''git pull''
 +
 +
 +====== update & merge ======
 +
 +''git pull''
 +
 +Holt Änderungen von Remote (fetch) **und führt sie mit dem lokalen Stand zusammen**  (merge). Bei Konflikten: Dateien manuell korrigieren und danach die geänderte Datei mit ''git add [dateiname]''  einbauen. Die Unterschiede sieht man mit
 +
 +''git diff <quell_branch> <ziel_branch>''
 +
 +==== Upstream nach fork mergen ====
 +
 +Lokales Ziel
 +
 +<code>
 +git checkout //master//
 +
 +</code>
 +
 +Welche branch von Upstream soll wohin geholt werden?
 +
 +<file>
 +git pull git@github.com:owncloud/docs.git BRANCH_NAME
 +
 +</file>
 +
 +Danach commit, review und push auf den fork bei Github
 +
 +===== Wenn etwas ganz schiefgeht =====
 +
 +''git checkout – ''
 +
 +setzt die lokalen Änderungen auf den letzten HEAD Stand. Änderungen, die du bereits zum Index hinzugefügt hast, bleiben bestehen.
 +
 +Hard Reset = Zurück auf den letzten Stand vom entfernten Repository:
 +
 +''git fetch origin''  ''git reset –hard origin/master''
 +
 +====== Pull requests ======
 +
 +Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
 +
 +[[https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github|https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github]]
 +
 +====== Basis Konfiguration eines Repos ======
 +
 +|<file>
 +git config -global user.name [name]
 +
 +git config -global user.email [email]
 +
 +git config -global core.editor [editor]
 +
 +</file>      |**GIT User Konfiguration setzen**   |
 +|''git config -l ''   |**Konfiguration zeigen**   |
 +|''git status ''   |**zeigt,ob eine Datei editiert wurde**   |
 +|''git-diff and git-status ''   |**Show the working tree status**   |
 +|''git commit ''   |**Änderungen einspielen**   |
 +|''git checkout -b branch2 ''   |**Wechsel zwischen Branches: Neuen Branch erstellen und dort hin wechseln**   |
 +|''git-reset[1] ''   |**Reset current HEAD to the specified state**   |
 +|''git-merge ''   |**Join two or more development histories together**   |
 +|''git-rebase ''   |**Reapply commits on top of another base tip**   |
 +|''git tag ''   |**Tags zeigen (z.B. einzelne Releases)**   |
 +|''git log ''   |**Letzte Commits zeigen**   |
 +|''git fetch <remote>''   |**Objektstruktur runterladen**   |
 +|  |  |
 +
 +====== Repo duplizieren ======
 +
 +Create a bare clone of the repository.
 +
 +$ git clone --bare https://github.com/exampleuser/old-repository.git
 +
 +Mirror-push to the new repository.
 +
 +$ cd old-repository.git
 +$ git push --mirror https://github.com/exampleuser/new-repository.git
 +
 +Remove the temporary local repository you created earlier.
 +
 +$ cd ..
 +$ rm -rf old-repository.git
 +
 +====== Markdown ======
 +
 +https://www.markdownguide.org/basic-syntax/ 
 +
 +[[https://guides.github.com/features/mastering-markdown/|https://guides.github.com/features/mastering-markdown/]]
 +
 +===== ASCIIDoc =====
 +
 +[[https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/|https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/]]
 +
 +==== Admonition ====
 +
 +<nowrap> NOTE: An admonition paragraph draws the reader's attention to auxiliary information. Its purpose is determined by the label at the beginning of the paragraph.
 +
 +Here are the other built-in admonition types:
 +
 +TIP: Pro tip…
 +
 +IMPORTANT: Don't forget…
 +
 +WARNING: Watch out for…
 +
 +CAUTION: Ensure that… </nowrap>
 +
 +==== Formatierung ====
 +
 +<nowrap> old *constrained* & **un**constrained
 +
 +italic _constrained_ & __un__constrained
 +
 +bold italic *_constrained_* & **__un__**  constrained
 +
 +monospace `constrained` & ``un``constrained
 +
 +monospace bold `*constrained*` & ``**un**``constrained
 +
 +monospace italic `_constrained_` & ``__un__``constrained
 +
 +monospace bold italic `*_constrained_*` & ``**__un__**``constrained </nowrap>
 +
 +Document header
 +
 +<nowrap> = My Document's Title Doc Writer <doc.writer@asciidoctor.org> v1.0, 2018-04-11 :toc: :imagesdir: assets/images :homepage: [[https://asciidoctor.org|https://asciidoctor.org]]
 +
 +My document provides… </nowrap>
 +
 +==== Überschriften ====
 +
 +''= Document Title (Level 0) == Level 1 Section Title === Level 2 Section Title ==== Level 3 Section Title ===== Level 4 Section Title ====== Level 5 Section Title == Another Level 1 Section Title ''
 +
 +==== Listen ====
 +
 +Unordered, basic[[https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#|view result]]
 +
 +<file>
 +* Edgar Allen Poe
 +* Sheri S. Tepper
 +* Bill Bryson
 +</file>
 +
 +Unordered, basic (alt)[[https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#|view result]]
 +
 +<file>
 +- Edgar Allen Poe
 +- Sheri S. Tepper
 +- Bill Bryson
 +</file>
 +
 +Nested Lists: To nest one list within another, indent each item in the sublist by four spaces. You can also nest other elements like paragraphs, blockquotes or code blocks.
 +
 +
 +===== Gitea =====
 +
 +Git with a cup of tea - A painless self-hosted Git service 
 +
 +https://gitea.io/en-us/
 +
 +https://dl.gitea.io/gitea/xxx/gitea-xxx-linux-arm64
 +
 +https://docs.gitea.io/en-us/upgrade-from-gitea/
 +
 +Upgrade script: /etc/scripts/gitea_upgrade.sh
 +
 +
  
  • git_gitea.txt
  • Zuletzt geändert: 05/03/2024 - 10:52
  • von 127.0.0.1