Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
programmieren_lernen:git [2023/12/27 12:38] 91.240.118.241 [Änderungen auf rechner2 mergen] |
programmieren_lernen:git [2023/12/27 12:55] (aktuell) 91.240.118.241 alte Version wiederhergestellt (2014/04/01 07:57) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/ | + | |
+ | ===== Repository erzeugen ===== | ||
+ | ssh rechner1 | ||
+ | cd /verzeichnis | ||
+ | git init | ||
+ | git add . | ||
+ | git commit -a | ||
+ | |||
+ | ===== Repository importieren ===== | ||
+ | ssh rechner2 | ||
+ | git clone ssh://rechner1/srv/fai/config | ||
+ | git remote add rechner1 ssh://rechner1/srv/fai/config | ||
+ | |||
+ | |||
+ | ===== Dateien auf rechner1 bearbeiten ===== | ||
+ | ssh rechner1 | ||
+ | |||
+ | ==== Änderungen betrachten ==== | ||
+ | git status | ||
+ | git diff --cached | ||
+ | |||
+ | ==== Änderungen im Repository speichern ==== | ||
+ | git commit -a | ||
+ | |||
+ | |||
+ | ===== Änderungen auf rechner2 mergen ===== | ||
+ | ==== Alles übertragen und mergen ==== | ||
+ | ssh rechner2 | ||
+ | git pull | ||
+ | |||
+ | ==== Übertragen, betrachten und mergen ==== | ||
+ | git fetch | ||
+ | git log -p HEAD..origin | ||
+ | git merge origin | ||
+ | |||
+ | ==== Einzelne Patches mergen ==== | ||
+ | statt ''git merge'': | ||
+ | git cherry-pick ac1a88a5c235055a41d961e898dfb8c0d3e17f72 | ||
+ | |||
+ | ====== How to fix mistakes ====== | ||
+ | Haven't committed yet, but don't want to save the changes? You can throw them away: | ||
+ | git reset --hard | ||
+ | You can also do it for individual files, but it's a bit different: | ||
+ | git checkout myfile.txt | ||
+ | Messed up the commit message? This will let you re-enter it: | ||
+ | git commit --amend | ||
+ | Forgot something in your last commit? That's easy to fix. | ||
+ | git reset --soft HEAD^ | ||
+ | Add that stuff you forgot: | ||
+ | git add forgot.txt these.txt | ||
+ | Then write over the last commit: | ||
+ | git commit | ||
+ | |||
+ | |||
+ | ====== Dokumentation ====== | ||
+ | * http://git-scm.com/documentation | ||
+ | * http://book.git-scm.com/ | ||
+ | * http://www.spheredev.org/wiki/Git_for_the_lazy | ||
+ | 1 |