Git: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Nick (Diskussion | Beiträge) |
Nick (Diskussion | Beiträge) |
||
| Zeile 16: | Zeile 16: | ||
== Branch == | == Branch == | ||
git checkout <Branch-Name> | git checkout <Branch-Name> # branch auschecken | ||
git checkout -b iss53 | git checkout -b iss53 # Neuen branch anlegen und auschecken | ||
git push --set-upstream origin iss53 # push new branch | |||
git branch -d iss53 # delete branch | |||
git checkout -- <Datei> | git checkout -- <Datei> #Änderung verwerfen | ||
== Stage/Commit == | == Stage/Commit == | ||
| Zeile 37: | Zeile 39: | ||
git clone --recurse-submodules https://path | git clone --recurse-submodules https://path | ||
== Tag == | |||
git tag -a v0.1 -m "Kommentar" # Tag | |||
git push origin v0.1 # push Tag | |||
Version vom 11. November 2022, 07:11 Uhr
Häufige Befehle
Config
git config --global user.name "Your Name" git config --global user.email "your_email@example.de" git config --global core.editor "vim"
Benutzername und Passwort für eine bestimmte Zeit speichern:
git config --global credential.helper cache git config --global credential.helper 'cache --timeout=600'
Clone
git clone <Repo-Pfad> git clone --branch <Branch-Name> <Repo-Pfad> git clone --recurse-submodules <Repo-Pfad> git clone --branch <Branch-Name> --recurse-submodules <Repo-Pfad>
Branch
git checkout <Branch-Name> # branch auschecken git checkout -b iss53 # Neuen branch anlegen und auschecken git push --set-upstream origin iss53 # push new branch git branch -d iss53 # delete branch git checkout -- <Datei> #Änderung verwerfen
Stage/Commit
git add . #Stagen git reset . #Staging verwerfen
git commit -m "commit Text" git reset --soft HEAD^ #Commit Rückgängig machen git reset --hard HEAD^ #Commit verwerfen
Submodule
Ist im Repo ein submodule und in diesem ebenfalls ein submodule welches mann updaten möchte muss das aus dem ersten submodule mit git submodule update --remote erfolgen.
git submodule add -b master <Repo-Pfad> <lokaler-Pfad> git submodule init git submodule update --remote git submodule update --init --recursive # init + update + untermodule
git clone --recurse-submodules https://path
Tag
git tag -a v0.1 -m "Kommentar" # Tag git push origin v0.1 # push Tag