{"thread":{"id":"20375","subject":"Merging to and from non-current branches.","startedAt":"2009-08-04T23:21:46Z","lastAt":"2009-08-06T18:43:16Z","messageCount":11,"participants":["lists@mgreg.com","Daniel Barkalow","Adam Brewster","Sverre Rabbelier","Alex Riesen","Randal L. Schwartz","Steffen Siebert","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"119542","messageId":"D5200130-C7D7-4010-BF62-3A3374F2E3B0@mgreg.com","threadId":"20375","inReplyTo":null,"subject":"Merging to and from non-current branches.","fromName":"lists@mgreg.com","fromEmail":"lists@mgreg.com","sentAt":"2009-08-04T23:21:46Z","receivedAt":"2009-08-04T23:21:46Z","isPatch":false,"sender":{"key":"lists@mgreg.com","avatar":null},"body":"Hi All,\n\nI've been reading up on some of the GIT commands and I'm not sure if  \nwhat I want/need exists.  Basically I want to merge all changes from  \none branch to another, regardless of whether I'm in either of those  \nbranches.  At the very least I would like to merge an existing  \n\"development\" branch with the \"master\" branch without needing to first  \ncheck out master.  I've seen rebase, but I'm not absolutely sure what  \nthat's doing.  Thoughts?\n\nBest,\nMichael\n"},{"id":"119547","messageId":"alpine.LNX.2.00.0908042236240.2147@iabervon.org","threadId":"20375","inReplyTo":"D5200130-C7D7-4010-BF62-3A3374F2E3B0@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-08-05T02:45:24Z","receivedAt":"2009-08-05T02:45:24Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 4 Aug 2009, lists@mgreg.com wrote:\n\n> Hi All,\n> \n> I've been reading up on some of the GIT commands and I'm not sure if what I\n> want/need exists.  Basically I want to merge all changes from one branch to\n> another, regardless of whether I'm in either of those branches.  At the very\n> least I would like to merge an existing \"development\" branch with the \"master\"\n> branch without needing to first check out master.  I've seen rebase, but I'm\n> not absolutely sure what that's doing.  Thoughts?\n\nIt can't work, because you need to be able to use the working tree to \nresolve any conflicts that arise during the merge. Merging without \nchecking out a branch is a bit like building without checking out a \nbranch; it would be avoiding using the filesystem for what it's there for.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"119548","messageId":"518952FC-626C-43FB-BD53-98DE849C9751@mgreg.com","threadId":"20375","inReplyTo":"alpine.LNX.2.00.0908042236240.2147@iabervon.org","subject":"Re: Merging to and from non-current branches.","fromName":"lists@mgreg.com","fromEmail":"lists@mgreg.com","sentAt":"2009-08-05T02:48:41Z","receivedAt":"2009-08-05T02:48:41Z","isPatch":false,"sender":{"key":"lists@mgreg.com","avatar":null},"body":"\nOn Aug 4, 2009, at 10:45 PM, Daniel Barkalow wrote:\n\n> On Tue, 4 Aug 2009, lists@mgreg.com wrote:\n>\n>> Hi All,\n>>\n>> I've been reading up on some of the GIT commands and I'm not sure  \n>> if what I\n>> want/need exists.  Basically I want to merge all changes from one  \n>> branch to\n>> another, regardless of whether I'm in either of those branches.  At  \n>> the very\n>> least I would like to merge an existing \"development\" branch with  \n>> the \"master\"\n>> branch without needing to first check out master.  I've seen  \n>> rebase, but I'm\n>> not absolutely sure what that's doing.  Thoughts?\n>\n> It can't work, because you need to be able to use the working tree to\n> resolve any conflicts that arise during the merge. Merging without\n> checking out a branch is a bit like building without checking out a\n> branch; it would be avoiding using the filesystem for what it's  \n> there for.\n>\n> \t-Daniel\n> *This .sig left intentionally blank*\n>\n\n\nHi Daniel,\n\nI appreciate your post.  I understand what you're saying, and I'm not  \nso much concerned about the logistics of what need to occur so much as  \na single command to intuitively handle it.  I've been doing a great  \ndeal of incremental development lately and it becomes rather tedious  \nto have to checkout master, merge dev, re-checkout dev and proceed.   \nI'm not sure why this isn't currently possible with a single command.   \nI suppose I could write a shell script to do so, but that's a little  \nless \"native\" than I'd like.\n\nBest,\n\nMichael\n"},{"id":"119554","messageId":"c376da900908042033x312f2e8bx966359c514e0bc9d@mail.gmail.com","threadId":"20375","inReplyTo":"518952FC-626C-43FB-BD53-98DE849C9751@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Adam Brewster","fromEmail":"adambrewster@gmail.com","sentAt":"2009-08-05T03:33:27Z","receivedAt":"2009-08-05T03:33:27Z","isPatch":false,"sender":{"key":"adambrewster@gmail.com","avatar":"https://avatars.githubusercontent.com/u/223816?v=4"},"body":"In case it helps, I think that if you're on branch dev, and you `merge\nmaster`, you should get a commit that's substantially similar to that\nthat you'd get if you're on master and you `merge dev`.\n\nThe most noticeable difference should be that if you `checkout master\n&& merge dev` the master is updated to point to the merged commit,\nwhereas if you `checkout dev && merge master` dev is updated to the\nnew commit.\n\n(If there are conflicts, then the merge processes will differ more\nsignificantly, but hopefully the human should be able to sort that\nout.)\n\nYou should be able to use git-reset and git update-ref to clean up the\nmess if that's not good enough.\n\nAdam Brewster\n\nOn Tue, Aug 4, 2009 at 10:48 PM, lists@mgreg.com<lists@mgreg.com> wrote:\n>\n> On Aug 4, 2009, at 10:45 PM, Daniel Barkalow wrote:\n>\n>> On Tue, 4 Aug 2009, lists@mgreg.com wrote:\n>>\n>>> Hi All,\n>>>\n>>> I've been reading up on some of the GIT commands and I'm not sure if what\n>>> I\n>>> want/need exists.  Basically I want to merge all changes from one branch\n>>> to\n>>> another, regardless of whether I'm in either of those branches.  At the\n>>> very\n>>> least I would like to merge an existing \"development\" branch with the\n>>> \"master\"\n>>> branch without needing to first check out master.  I've seen rebase, but\n>>> I'm\n>>> not absolutely sure what that's doing.  Thoughts?\n>>\n>> It can't work, because you need to be able to use the working tree to\n>> resolve any conflicts that arise during the merge. Merging without\n>> checking out a branch is a bit like building without checking out a\n>> branch; it would be avoiding using the filesystem for what it's there for.\n>>\n>>        -Daniel\n>> *This .sig left intentionally blank*\n>>\n>\n>\n> Hi Daniel,\n>\n> I appreciate your post.  I understand what you're saying, and I'm not so\n> much concerned about the logistics of what need to occur so much as a single\n> command to intuitively handle it.  I've been doing a great deal of\n> incremental development lately and it becomes rather tedious to have to\n> checkout master, merge dev, re-checkout dev and proceed.  I'm not sure why\n> this isn't currently possible with a single command.  I suppose I could\n> write a shell script to do so, but that's a little less \"native\" than I'd\n> like.\n>\n> Best,\n>\n> Michael\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"119556","messageId":"fabb9a1e0908042046w174d2591n2d9502d81a795d3a@mail.gmail.com","threadId":"20375","inReplyTo":"518952FC-626C-43FB-BD53-98DE849C9751@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-08-05T03:46:04Z","receivedAt":"2009-08-05T03:46:04Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Aug 4, 2009 at 19:48, lists@mgreg.com<lists@mgreg.com> wrote:\n> I appreciate your post.  I understand what you're saying, and I'm not so\n> much concerned about the logistics of what need to occur so much as a single\n> command to intuitively handle it.  I've been doing a great deal of\n> incremental development lately and it becomes rather tedious to have to\n> checkout master, merge dev, re-checkout dev and proceed.  I'm not sure why\n> this isn't currently possible with a single command.  I suppose I could\n> write a shell script to do so, but that's a little less \"native\" than I'd\n> like.\n\nYou might want to try out an alias:\n\n$ git config alias.update \"!git checkout master && git merge dev &&\ngit checkout dev\"\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"119702","messageId":"81b0412b0908051428g40b7678ewc549f079abbd03ee@mail.gmail.com","threadId":"20375","inReplyTo":"518952FC-626C-43FB-BD53-98DE849C9751@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-08-05T21:28:24Z","receivedAt":"2009-08-05T21:28:24Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Wed, Aug 5, 2009 at 04:48, lists@mgreg.com<lists@mgreg.com> wrote:\n> I appreciate your post.  I understand what you're saying, and I'm not so\n> much concerned about the logistics of what need to occur so much as a single\n> command to intuitively handle it.  I've been doing a great deal of\n> incremental development lately and it becomes rather tedious to have to\n> checkout master, merge dev, re-checkout dev and proceed.  I'm not sure why\n> this isn't currently possible with a single command.\n\nBecause no one needed this sequence of commands for long enough.\n\n> I suppose I could write a shell script to do so, but that's a little less \"native\"\n> than I'd like.\n\nBut that's absolutely native to Git. Many Git commands are just shell scripts!\nMany guarantee (the \"plumbing\") you stability and machine-readability of\ntheir output precisely for this reason.\n\nWrite your script, propose it here, and there will be enough interest it'll land\nin the official distribution (or, more likely, in the \"contrib\"\ndirectory of it).\n"},{"id":"119726","messageId":"C766A4F9-C12B-4F94-8B24-9BD3665B70E8@mgreg.com","threadId":"20375","inReplyTo":"81b0412b0908051428g40b7678ewc549f079abbd03ee@mail.gmail.com","subject":"Re: Merging to and from non-current branches.","fromName":"lists@mgreg.com","fromEmail":"lists@mgreg.com","sentAt":"2009-08-06T01:48:34Z","receivedAt":"2009-08-06T01:48:34Z","isPatch":false,"sender":{"key":"lists@mgreg.com","avatar":null},"body":"\nOn Aug 5, 2009, at 5:28 PM, Alex Riesen wrote:\n\n> On Wed, Aug 5, 2009 at 04:48, lists@mgreg.com<lists@mgreg.com> wrote:\n>> I appreciate your post.  I understand what you're saying, and I'm  \n>> not so\n>> much concerned about the logistics of what need to occur so much as  \n>> a single\n>> command to intuitively handle it.  I've been doing a great deal of\n>> incremental development lately and it becomes rather tedious to  \n>> have to\n>> checkout master, merge dev, re-checkout dev and proceed.  I'm not  \n>> sure why\n>> this isn't currently possible with a single command.\n>\n> Because no one needed this sequence of commands for long enough.\n\nAs I said, I understand what is being said, but in IMHO it would seem  \nthat a merge of that nature would be immediately desirable.  Think of  \nit more as a local \"push\".  I'm never a fan of \"because it hasn't be  \ndone means it shouldn't be\".  I realize that's not exactly what you're  \nsaying though.  Anyway, I absolutely appreciate the post, and may very  \nwell post the script.\n\nBest,\n\nMichael\n"},{"id":"119731","messageId":"86y6pxsn6h.fsf@blue.stonehenge.com","threadId":"20375","inReplyTo":"C766A4F9-C12B-4F94-8B24-9BD3665B70E8@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2009-08-06T02:15:02Z","receivedAt":"2009-08-06T02:15:02Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"mgreg\" == lists@mgreg com <lists@mgreg.com> writes:\n\nmgreg> As I said, I understand what is being said, but in IMHO it would seem\nmgreg> that a merge of that nature would be immediately desirable.  Think of\nmgreg> it more as a local \"push\".  I'm never a fan of \"because it hasn't be\nmgreg> done means it shouldn't be\".  I realize that's not exactly what you're\nmgreg> saying though.  Anyway, I absolutely appreciate the post, and may very\nmgreg> well post the script.\n\nIn other words, you'd be happy with it if it was just a fast-forward only?\n\nBecause the moment you might have conflicts, that *has* to be the workdir\nso you can resolve those conflicts.  Dunno why this is so hard to grok.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion\n"},{"id":"119772","messageId":"loom.20090806T115042-526@post.gmane.org","threadId":"20375","inReplyTo":"518952FC-626C-43FB-BD53-98DE849C9751@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Steffen Siebert","fromEmail":"git@steffensiebert.de","sentAt":"2009-08-06T11:54:30Z","receivedAt":"2009-08-06T11:54:30Z","isPatch":false,"sender":{"key":"git@steffensiebert.de","avatar":null},"body":"lists <at> mgreg.com <lists <at> mgreg.com> writes:\n\n> a single command to intuitively handle it.  I've been doing a great  \n> deal of incremental development lately and it becomes rather tedious  \n> to have to checkout master, merge dev, re-checkout dev and proceed.   \n> I'm not sure why this isn't currently possible with a single command.   \n> I suppose I could write a shell script to do so, but that's a little  \n> less \"native\" than I'd like.\n\nHi Michael,\n\nI had a similar problem (we are doing rebases instead of merges) and found a way\nto rebase and push my changes onto the master without the need of a \"checkout\nmaster\".\n\nYou can find my question and the approved (green) answer that works for me on\nstackoverflow.com:\n\nhttp://stackoverflow.com/questions/945372/how-to-efficiently-rebase-and-push-a-local-git-branch\n\nMaybe this works for you, too.\n\nCiao,\n  Steffen\n"},{"id":"119808","messageId":"alpine.LNX.2.00.0908061320030.2147@iabervon.org","threadId":"20375","inReplyTo":"C766A4F9-C12B-4F94-8B24-9BD3665B70E8@mgreg.com","subject":"Re: Merging to and from non-current branches.","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-08-06T17:41:58Z","receivedAt":"2009-08-06T17:41:58Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 5 Aug 2009, lists@mgreg.com wrote:\n\n> \n> On Aug 5, 2009, at 5:28 PM, Alex Riesen wrote:\n> \n> >On Wed, Aug 5, 2009 at 04:48, lists@mgreg.com<lists@mgreg.com> wrote:\n> > >I appreciate your post.  I understand what you're saying, and I'm not so\n> > >much concerned about the logistics of what need to occur so much as a\n> > >single\n> > >command to intuitively handle it.  I've been doing a great deal of\n> > >incremental development lately and it becomes rather tedious to have to\n> > >checkout master, merge dev, re-checkout dev and proceed.  I'm not sure why\n> > >this isn't currently possible with a single command.\n> >\n> >Because no one needed this sequence of commands for long enough.\n> \n> As I said, I understand what is being said, but in IMHO it would seem that a\n> merge of that nature would be immediately desirable.  Think of it more as a\n> local \"push\".\n\nYou mean like \"git push . dev:master\"? That does work in the case where a \ncontent merge is not required (although not otherwise).\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"119812","messageId":"7vprb8lr5n.fsf@alter.siamese.dyndns.org","threadId":"20375","inReplyTo":"alpine.LNX.2.00.0908061320030.2147@iabervon.org","subject":"Re: Merging to and from non-current branches.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-06T18:43:16Z","receivedAt":"2009-08-06T18:43:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n>> As I said, I understand what is being said, but in IMHO it would seem that a\n>> merge of that nature would be immediately desirable.  Think of it more as a\n>> local \"push\".\n>\n> You mean like \"git push . dev:master\"? That does work in the case where a \n> content merge is not required (although not otherwise).\n\nJust to clarify.\n\nIt works _only_ when the push is a fast forward, i.e. where a merge is not\nrequired.\n\nThat is different from working in a case \"where a content merge is not\nrequired\".\n\nThe word \"content merge\" is often used in contrast to \"tree level merge\",\nmeaning the latter can be finished by flipping stages inside the index by\nthe three-way read-tree (--aggressive) while the former needs to call out\nto \"merge-one-file\".\n\nBut the push will be rejected if you need _any_ kind of merge.\n"}]}