{"thread":{"id":"29286","subject":"Fwd: git and github query about maintaining project","startedAt":"2012-01-03T19:42:38Z","lastAt":"2012-01-03T20:21:37Z","messageCount":2,"participants":["manoj soni","Seth Robertson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"181880","messageId":"CA+KSefW+K1hMiFkrFCP1LAVjfV9hECwFWAHz940fwGJawHuoFQ@mail.gmail.com","threadId":"29286","inReplyTo":"CA+KSefVajgEBCH+31a0DLXPGUgb2yshxPeXV+SdmGvPFVBOBtg@mail.gmail.com","subject":"Fwd: git and github query about maintaining project","fromName":"manoj soni","fromEmail":"manoj6891@gmail.com","sentAt":"2012-01-03T19:42:38Z","receivedAt":"2012-01-03T19:42:38Z","isPatch":false,"sender":{"key":"manoj6891@gmail.com","avatar":null},"body":"Dear Admin,\nForwarding you below email, which I have sent to wrong email address by mistake.\n\nThanks,\nManoj\n\n\n---------- Forwarded message ----------\nFrom: manoj soni <manoj6891@gmail.com>\nDate: Tue, Jan 3, 2012 at 2:20 PM\nSubject: git and github query about maintaining project\nTo: git@vger.kernel.orgm, support@github.com\n\n\nDear Admin,\nI am using git along with github since august 2011. I am new to it but\nnow I know it significantly. It is interesting and helpful.\nI have started with a already existing project (say P). We were two\npersons working on this project, so we forked P (on github). I got\nproject forked copy C1 and my friend got C2. We each have committed to\nC1 and C2 independently. Now my friend merged his commits from C2 to P\nand moved out of this project. I have created a branch OLD in my\nrepository C1 along with a already existing master branch. What I want\nto do that in my project C1, OLD branch should have all of my commits\nand master branch should be same as P. Please tell how should I do\nthis? I am trying since a week to get it done, I have attempted some\nunsuccessful tries, which I can tell you if you want. If you need more\ninformation, please tell me.\n\nHope to get response.\nI shall be thankful.\nManoj Soni\n"},{"id":"181891","messageId":"201201032021.q03KLblT024296@no.baka.org","threadId":"29286","inReplyTo":"CA+KSefW+K1hMiFkrFCP1LAVjfV9hECwFWAHz940fwGJawHuoFQ@mail.gmail.com","subject":"Re: git and github query about maintaining project","fromName":"Seth Robertson","fromEmail":"in-gitvger@baka.org","sentAt":"2012-01-03T20:21:37Z","receivedAt":"2012-01-03T20:21:37Z","isPatch":false,"sender":{"key":"in-gitvger@baka.org","avatar":null},"body":"\nIn message <CA+KSefW+K1hMiFkrFCP1LAVjfV9hECwFWAHz940fwGJawHuoFQ@mail.gmail.com>, manoj soni writes:\n\n    Forwarding you below email, which I have sent to wrong email address by mistake.\n\nYou might want to ask on the IRC #git channel for tactical support\nquestions, like this. irc://irc.freenode.net/git\n\n    we forked P (on github),  I got project forked copy C1\n\n    What I want to do that in my project C1, OLD branch should have\n    all of my commits and master branch should be same as P.\n\nTactically, the answer to your question is as follows:\n----------------------------------------------------------------------\n# Create a new branch OLD from where master is (presumably containing your commits)\ngit checkout -b OLD master\n\n# Share OLD with your forked C1 (if you want to)\ngit push origin OLD\ngit branch --set-upstream OLD origin/OLD\n\n# Get access to the repository you forked from\ngit remote add P URL-TO-P\ngit fetch P\n\n# Reset the master branch to the contents of P/master\n#  Please note that any uncommitted changes WILL BE LOST\ngit checkout master\ngit reset --hard P/master\n\n# Share your rewritten history with origin (C1)\n#  Please note, rewriting publicly visible history is a BAD IDEA.\n#  Anyone else who might have pulled the old history will have to do\n#  special things and may hate you forever.\ngit push -f origin\n----------------------------------------------------------------------\n\nHowever, interpreting what you are really trying to do (get your\nchanges and C2's changes put together and uploaded to P), this is what\n*I* would do:\n----------------------------------------------------------------------\n# Get access to the repository you forked from git remote add P\nURL-TO-P git fetch P\n\n# Merge your development with the other development that has been happening\ngit merge origin/P\n\n# Share your rewritten history with origin (C1)\ngit push\n\n# When you have finished testing (unless you are using the github pull request method)\ngit push P master\n----------------------------------------------------------------------\n\n\t\t\t\t\t-Seth Robertson\n"}]}