sma hat geschrieben:Ich verstehe diese Fork-Queue nicht. Ich habe gestern bottle geforkt und dennoch bietet er mit zwei Patches von vor 4 Tagen an (von denen "Remove README" nicht funktioniert). Er bietet mir aber auch meine Patches an, die defnull jetzt übernommen hat und sagt - zurecht - die werden nicht passen. Wie soll ich denn jetzt mit meinem Fork up-to-date bleiben?
Ich möchte ja echt git mögen, aber manchmal ist das schon verdammt kompliziert und unübersichtlich.
Die ForkQueue von GutHub scheint im Hintergrund 'git cherrypick' zu verwenden. Dadurch werden einzelne Patches (statt alle, wie beim merge) übernommen, aber git erzeugt bei cherrypick neue Patches mit neuen commits, was dazu führt das die Patches doppelt angezeigt werden.
Bei einem 'git merge' würden die commits sauber übernommen, aber dafür müsste ich jeden einzelnen Patch von dir übernehmen, was in diesem Fall geklappt hätte, aber nicht immer geht. Die ForkQueue von GitHub ist zwar schön, aber nicht der Weg, den man mit git normalerweise geht. Ich werds in Zukunft nicht mehr benutzen.
Ich kann ja mal ne Mail zitieren, die ich letzten zu dem Thema geschrieben habe. Ein kleines Git HowTo. Vielleicht hilft das. Aber du hast schon recht, git ist in seinen Einzelheiten sehr gewöhnungsbedürftig und nicht immer intuitiv. Dafür ist es eben sehr mächtig im Vergleich zu anderen Systemen.
First, you create a remote (a shortcut) called 'upstream' that points to my GitHub repository. You only need to do this once:
Code: Alles auswählen
git remote add -f upstream git://github.com/defnull/bottle.git
Then you can create a new clean branch that tracks my remote master branch. You should do this every time you you start working on a new patch, so unrelated patches are in different branches. Git is designed to work with branches. This way I can pull a particular branch without touching the changes you made in other branches.
Now you have a clean copy of my master-branch in 'newbranch', ready to modify. Don't forget to 'git checkout newbranch'.
Before I can pull from your new branch, you have to push it to github. If you followed the GitHub hints, 'origin' should be a remote pointing to your own GitHub fork. So lets push newbranch to origin:
Now I can see your new branch and pull from it.
If upstream changes, you can update your local copy with this command. Git knows that your branch is tracking my master branch, so you don't have do specify it again.
If you had made changes to your newbranch already, a 'git pull' would cause a merge of both branches. On conflicts, this would produce another dirty branch. A better way is 'git rebase'. That command saves all your local changes, resets your branch to the HEAD of my master branch, reapplies your changes and let you resolve the conflicts. This way your branch keeps clean and I can pull from it without problems.
I hadn't tested what I just wrote, but I thing it should work as said. Hope, that helps
In deinem Fall ist es etwas komplizierter. Du hast zwei Patches, die du nicht mehr brauchst, da ich sie übernommen habe (auch wen github sie als unterschiedliche commits erkennt, dank des blöden cherrypick). Du kannst sie mit 'git reset --hard HEAD^^' wirft die letzten zwei commits einfach weg. Dann kannst du ein 'git pull' machen um dich auf den neuesten Stand bringe und mit einem 'git push -f' GitHub zwingen, die Änderungen zu übernehmen. Das '-f' ist nötig, da 'git reset' die History verändert, was eigentlich etwas ist, das man vermeiden sollte. Daher ja auch die vielen unterschiedlichen Branches, die man normalerweise nach Herzenslust weg schmeißen und um modeln kann.