Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Nächste Überarbeitung | Vorherige Überarbeitung Letzte Überarbeitung Beide Seiten, nächste Überarbeitung | ||
programmieren_lernen:git [2014/04/01 07:57] 127.0.0.1 Externe Bearbeitung |
programmieren_lernen:git [2023/12/27 12:38] 91.240.118.241 [Änderungen auf rechner2 mergen] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ===== Repository erzeugen ===== | + | @@PIEGx |
- | 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 | + |