-
Notifications
You must be signed in to change notification settings - Fork 63
Howto git
Hints taken from Scott Chacon’s book “Pro Git”
To get the server repository: git clone [email protected]:zdia/gorilla.git
To fix local changes: git commit -am “My commit description”
Before you upload your changes it is necessary to synchronize the local clone with the server repository:
git fetch origin
git merge origin/branchname
To upload the changes to the server into the branch master: git push origin master
You want to know before you push if there is any change on the server and so you get at first the commit history: git log --no-merges origin/master
To create a branch or make it the actual: git checkout -b branchname
To upload a branch onto the server: git push origin branch
To make a branch the actual: git checkout branchname
To merge a branch with the actual checkout branch: git merge branchname
To delete a branch: git branch -d testing
To get the commit history:
git log --pretty=oneline
git log --date=short --pretty=format:“%ad: %s” --since=“4 month ago”
To create a tag: git tag -a commitkey -m “tag description”
To push all tags to the server: git push origin --tags
To push one tag to the server: git push origin tag tagname
einen lokalen branch löschen: git branch -d branchname
einen lokalen tag löschen: git tag -d tagname
einen remote branch löschen: git push origin :branchname
einen remote tag löschen: git push origin :tagname
git format-patch HEAD^^^
Es werden Dateien in der Form 0001-commit-message erzeugt, die die Commit-Diffs und Metadaten enthalten. Ein Hinweis zu den drei Caret Symbolen: Füge einfach eins pro Commit hinzu, die du zurück gehen möchtest, und sei konsistent! Update: Auf die letzten Commits kannst du auch mit der Syntax HEAD~n verweisen, in diesem Beispiel würden wir HEAD~3 verwenden. Fahre fort und bearbeite diese Dateien mit deinem Lieblingseditor, so dass sie die passenden Informationen erhalten. Sobald du fertig bist, setzt du dein Repository um ein paar Commits zurück:
git reset --hard HEAD^^^
Jetzt kann jeder Commit angewendet werden und die Informationen werden behoben. Stelle die richtige Reihenfolge sicher! (gewöhnlich in aufsteigender Reihenfolge). Erstelle nun die Commits:
git am < 0001...
git am < 0002...
git am < 0003...
Wenn du jetzt git log überprüfst, solltest du die richtigen Informationen sehen. Ist etwas schief gegangen, bist du mit folgendem Kommando wieder am Ausgangspunkt:
git reset --hard master