{"thread":{"id":"29038","subject":"Copy branch into master","startedAt":"2011-11-28T18:25:33Z","lastAt":"2011-12-01T19:43:54Z","messageCount":7,"participants":["Ron Eggler","Andrew Eikum","Tay Ray Chuan","Neal Kreitzinger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"180055","messageId":"CAHxBh_T-f7O4r0zn=NtLTYtdbNqd3qSo2tW84aYRJp7ugDSMpw@mail.gmail.com","threadId":"29038","inReplyTo":null,"subject":"Copy branch into master","fromName":"Ron Eggler","fromEmail":"ron.eggler@gmail.com","sentAt":"2011-11-28T18:25:33Z","receivedAt":"2011-11-28T18:25:33Z","isPatch":false,"sender":{"key":"ron.eggler@gmail.com","avatar":null},"body":"Hi,\n\nSome time ago I created a DVT branch in my project and I have almost been\nexclusively working in it. Now the time for some test deployment came and I\ndidn't have time to merge it all back into the master thus I gave out the\nDVT branch version. Now I would like to copy exactly what I have in that\nbranch back into my master to have an exact copy in my master of what got\ndeployed with out any changes.\nHow can I do this?\nPlease advise.\n\nThank you!\nRon\n--\nRon Eggler\n1804 - 1122 Gilford St.\nVancouver, BC\nV6G 2P5\n(778) 230-9442\n"},{"id":"180056","messageId":"20111128183616.GB29503@foghorn.codeweavers.com","threadId":"29038","inReplyTo":"CAHxBh_T-f7O4r0zn=NtLTYtdbNqd3qSo2tW84aYRJp7ugDSMpw@mail.gmail.com","subject":"Re: Copy branch into master","fromName":"Andrew Eikum","fromEmail":"aeikum@codeweavers.com","sentAt":"2011-11-28T18:36:16Z","receivedAt":"2011-11-28T18:36:16Z","isPatch":false,"sender":{"key":"aeikum@codeweavers.com","avatar":null},"body":"On Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:\n> Some time ago I created a DVT branch in my project and I have almost been\n> exclusively working in it. Now the time for some test deployment came and I\n> didn't have time to merge it all back into the master thus I gave out the\n> DVT branch version. Now I would like to copy exactly what I have in that\n> branch back into my master to have an exact copy in my master of what got\n> deployed with out any changes.\n> How can I do this?\n\nCouple options, depending on what you want:\n\nRename DVT to master (similar to 'mv DVT master', including\nlosing the contents of 'master'):\n$ git checkout --detach HEAD\n$ git branch -M DVT master\n$ git checkout master\n\nRetain old master (like 'mv master old_master; mv DVT master'):\n$ git checkout --detach HEAD\n$ git branch -m master old_master\n$ git branch -m DVT master\n$ git checkout master\n\nThe \"checkout --detach\" is just so Git doesn't complain about\nmoving/deleting the currently checked out branch.\n\nIf you haven't yet, be sure to read ProGit, which should make\nquestions like this trivial for you to answer yourself in the future:\n<http://progit.org/book/>\n\nHope this helps,\nAndrew\n"},{"id":"180058","messageId":"3655DADD9B52450B81B0CD34F1B0FAB6@bny.us.bosch.com","threadId":"29038","inReplyTo":"20111128183616.GB29503@foghorn.codeweavers.com","subject":"RE: Copy branch into master","fromName":"Ron Eggler","fromEmail":"ron.eggler@gmail.com","sentAt":"2011-11-28T19:08:33Z","receivedAt":"2011-11-28T19:08:33Z","isPatch":false,"sender":{"key":"ron.eggler@gmail.com","avatar":null},"body":"Thanks for that,\n\nI guess I'd go for renaming DVT to master.\n\nHowever, I also played around with merge a little, started a merge (in\nWindows GUI) and aborted it but the icon of my directory keeps showing the\nywellow exclemation mark, signing that a merge is going on right now but\ngoing into the directory, all the files are with a geen check mark. What's\ngoing on here? How do I resolve this - I don't wanna mess things up so I\nmight rather resolve this before moving DVT to master.\n\nThanks,\nRon\n\n-----Original Message-----\nFrom: Andrew Eikum [mailto:aeikum@codeweavers.com] \nSent: Monday, November 28, 2011 10:36 AM\nTo: Ron Eggler\nCc: git@vger.kernel.org\nSubject: Re: Copy branch into master\n\nOn Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:\n> Some time ago I created a DVT branch in my project and I have almost been\n> exclusively working in it. Now the time for some test deployment came and\nI\n> didn't have time to merge it all back into the master thus I gave out the\n> DVT branch version. Now I would like to copy exactly what I have in that\n> branch back into my master to have an exact copy in my master of what got\n> deployed with out any changes.\n> How can I do this?\n\nCouple options, depending on what you want:\n\nRename DVT to master (similar to 'mv DVT master', including\nlosing the contents of 'master'):\n$ git checkout --detach HEAD\n$ git branch -M DVT master\n$ git checkout master\n\nRetain old master (like 'mv master old_master; mv DVT master'):\n$ git checkout --detach HEAD\n$ git branch -m master old_master\n$ git branch -m DVT master\n$ git checkout master\n\nThe \"checkout --detach\" is just so Git doesn't complain about\nmoving/deleting the currently checked out branch.\n\nIf you haven't yet, be sure to read ProGit, which should make\nquestions like this trivial for you to answer yourself in the future:\n<http://progit.org/book/>\n\nHope this helps,\nAndrew\n"},{"id":"180060","messageId":"20111128192659.GD29503@foghorn.codeweavers.com","threadId":"29038","inReplyTo":"3655DADD9B52450B81B0CD34F1B0FAB6@bny.us.bosch.com","subject":"Re: Copy branch into master","fromName":"Andrew Eikum","fromEmail":"aeikum@codeweavers.com","sentAt":"2011-11-28T19:26:59Z","receivedAt":"2011-11-28T19:26:59Z","isPatch":false,"sender":{"key":"aeikum@codeweavers.com","avatar":null},"body":"On Mon, Nov 28, 2011 at 11:08:33AM -0800, Ron Eggler wrote:\n> I guess I'd go for renaming DVT to master.\n> \n> However, I also played around with merge a little, started a merge (in\n> Windows GUI) and aborted it but the icon of my directory keeps showing the\n> ywellow exclemation mark, signing that a merge is going on right now but\n> going into the directory, all the files are with a geen check mark. What's\n> going on here? How do I resolve this - I don't wanna mess things up so I\n> might rather resolve this before moving DVT to master.\n> \n\nSorry, I have no idea how to use any of the GUI tools. Perhaps your\nGUI tool has a mailing list where you can ask about merge conflict\nresolution?\n\nAndrew\n"},{"id":"180061","messageId":"CB09450076EA444CA289CDCB995F16A4@bny.us.bosch.com","threadId":"29038","inReplyTo":"20111128192659.GD29503@foghorn.codeweavers.com","subject":"RE: Copy branch into master","fromName":"Ron Eggler","fromEmail":"ron.eggler@gmail.com","sentAt":"2011-11-28T19:30:59Z","receivedAt":"2011-11-28T19:30:59Z","isPatch":false,"sender":{"key":"ron.eggler@gmail.com","avatar":null},"body":"> Sorry, I have no idea how to use any of the GUI tools. Perhaps your\n> GUI tool has a mailing list where you can ask about merge conflict\n> resolution?\n\nNo problem, I actually got it all figured out now, and got my branch\nsmoothly merged back into master.\nThanks for your help!\n\nRon\n"},{"id":"180086","messageId":"CALUzUxrxX7Av6OSb5qHMSCua-Y8dGdf8ux1yLoCwNJeXtd-kow@mail.gmail.com","threadId":"29038","inReplyTo":"20111128183616.GB29503@foghorn.codeweavers.com","subject":"Re: Copy branch into master","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2011-11-29T12:49:49Z","receivedAt":"2011-11-29T12:49:49Z","isPatch":false,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"On Tue, Nov 29, 2011 at 2:36 AM, Andrew Eikum <aeikum@codeweavers.com> wrote:\n> On Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:\n>> Some time ago I created a DVT branch in my project and I have almost been\n>> exclusively working in it. Now the time for some test deployment came and I\n>> didn't have time to merge it all back into the master thus I gave out the\n>> DVT branch version. Now I would like to copy exactly what I have in that\n>> branch back into my master to have an exact copy in my master of what got\n>> deployed with out any changes.\n>> How can I do this?\n>\n> Couple options, depending on what you want:\n>\n> Rename DVT to master (similar to 'mv DVT master', including\n> losing the contents of 'master'):\n> $ git checkout --detach HEAD\n> $ git branch -M DVT master\n> $ git checkout master\n\nIt might not be wise to take the strict definition of rename = move\n(copy + delete). You will lose *all* your reflog associated with\nmaster. The old master is gone forever.\n\nResetting the branch is \"safer\". It's like pseudo-copying the branch.\nThe reflog for both branches are still around. You can do this with\n\n # on master\n $ git reset --hard DVT\n\nor\n\n # not on master\n $ git branch -f master dvt\n\n-- \nCheers,\nRay Chuan\n"},{"id":"180216","messageId":"4ED7D8FA.5000305@gmail.com","threadId":"29038","inReplyTo":"CB09450076EA444CA289CDCB995F16A4@bny.us.bosch.com","subject":"Re: Copy branch into master","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2011-12-01T19:43:54Z","receivedAt":"2011-12-01T19:43:54Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 11/28/2011 1:30 PM, Ron Eggler wrote:\n>> Sorry, I have no idea how to use any of the GUI tools. Perhaps your\n>> GUI tool has a mailing list where you can ask about merge conflict\n>> resolution?\n>\n> No problem, I actually got it all figured out now, and got my branch\n> smoothly merged back into master.\n>\nThat is not what you originally asked for.  What you asked for was:\n\"Now I would like to copy exactly what I have in that branch back into \nmy master to have an exact copy in my master of what got deployed with \nout any changes.\"  If you did a git-merge then what you did was combine \nmaster with DVT.  That most likely did not make master equal to DVT.  If \nyou run the following git-diff the results will likely show they do not \nmatch:\n$ git-diff --name-only sha1-of-master-after-DVT-merge \nsha1-of-DVT-before-merge-to-master\n\nIf you merge branch A into branch B it does not make branch B equal to \nbranch A.  It makes branch B a combination of branch B and branch A \n(plus your merge conflict resolutions).  If you truly want to make \nmaster exactly match DVT then I recommend the following: (I'm assuming \nthis is not a superproject containing submodules, and that you are using \nlinux.  I am using git 1.7.1.)\n\n(Return master to the state it was in when you asked the question)\n(1) git checkout master\n(2) git branch BKUP-master-DVT-merge (backup your current post-merge \nmaster to another branch)\n(3) git reset --hard sha1-of-master-before-merge\n\n(Return DVT to the state it was in when you asked the question)\n(1) git checkout DVT\n(2) git branch BKUP-DVT-B4-merge (backup current DVT if it has new work)\n(3) git reset --hard sha1-of-DVT-before-merge\n\n(Make master match DVT exactly)\n(1) Use the \"vendor branch code drop\" method described in the git-rm \nmanpage* (see note on permissions below).  (Use the git-archive command \nto create your tarball of DVT for this.)\n(2) After \"vendor branch code drop\" is committed, git-diff --name-status \nmaster DVT (they should match, ie. no results that matter)\n(3) git-tag the resulting commit to make it clear this is the version \nyou deployed.\n\n*Note: if you are tracking permissions in git (executable vs. \nnon-executable bits) then you will need to accomodate and validate \npermissions in your git-archive and/or ensure permissions are set \nproperly before committing your vendor branch code drop.  Otherwise, you \nwill have permissions changes that do not exactly match DVT.\n\nI recommend trying the above on a test copy of your repo to verify the \nresults are really what you want.\n(tar up your repo as root to retain permissions, and untar in test dir)\n(repo path = /home/me/MY-REPO)\n(1) pwd ( = /home/me)\n(2) mkdir test\n(3) su root\n(4) pwd ( = /home/me)\n(5) tar -cvzf MY-REPO.tar.gz MY-REPO/\n(6) cd test\n(7) mv ../MY-REPO.tar.gz .\n(8) tar -xvzf MY-REPO.tar.gz\n(test repo path = /home/me/test/MY-REPO)\n(9) exit\n(10) cd /home/me/test/MY-REPO\n(11) try out what I said on test/MY-REPO and then decide if you want to \ndo it on the real me/MY-REPO.\n\nIf you already have additional commits on master after your master-DVT \nmerge then they are backed up in the BKUP-master-DVT-merge branch you \nmade earlier.  These commits can then be interactively rebased on your \nremediated master.  (Be aware of any possible unique master-DVT merged \ncode the new commits are dependent on.  If so, that code needs to be \nreincorporated instead of being unwittingly lost.)\n\nAll the above assumes that others have not already pulled your \nmaster-DVT merge and based their work on it.  If they have already \npulled your new master and based work on it then it may be too late for \nthis to be practical, or additional steps would be needed for others to \nproperly remediate.  I'm assuming you have a known set of developers \npulling from you.  It is possible for them to interactively rebase their \nnew work onto your remediated master and take the merged-master out of \ntheir history.  (Be aware of any possible unique master-DVT merged code \nthe new commits are dependent on.  If so, that code needs to be \nreincorporated instead of being unwittingly lost.)\n\nHope this helps.\n\nv/r,\nneal\n"}]}