Inhaltsverzeichnis

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

1