{"thread":{"id":"21499","subject":"How to merge into my working copy?","startedAt":"2009-11-06T14:53:02Z","lastAt":"2009-11-06T18:15:37Z","messageCount":4,"participants":["Patrick Doyle","Bruce Stephens","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"126979","messageId":"e2a1d0aa0911060653t7bbb54ebp948eac0dffeaba64@mail.gmail.com","threadId":"21499","inReplyTo":null,"subject":"How to merge into my working copy?","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2009-11-06T14:53:02Z","receivedAt":"2009-11-06T14:53:02Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"I would like to pull a set of changes from a branch back into the\nworking copy of my current branch without affecting the index.  I\ncan't figure out the right combination of --commit, --no-commit, -ff,\n-no-ff, --log, --no-log, --squash, --no-squash, etc... options to use\nwith git-merge.\n\nBasically, I created a branch off my mainline branch a few days ago.\nMade some commits on that branch.  Then went back to my mainline\nbranch, made a few commits there, and now I would like to make my\nworking copy look like a merge of its current state with the changes\nfrom the branch, minus any associated commits.\n\nI probably should have just used git-stash to tuck those changes away,\nbut I didn't.\n\n--wpd\n"},{"id":"126980","messageId":"80aayzg0mj.fsf@tiny.isode.net","threadId":"21499","inReplyTo":"e2a1d0aa0911060653t7bbb54ebp948eac0dffeaba64@mail.gmail.com","subject":"Re: How to merge into my working copy?","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2009-11-06T14:59:32Z","receivedAt":"2009-11-06T14:59:32Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"Patrick Doyle <wpdster@gmail.com> writes:\n\n[...]\n\n> Basically, I created a branch off my mainline branch a few days ago.\n> Made some commits on that branch.  Then went back to my mainline\n> branch, made a few commits there, and now I would like to make my\n> working copy look like a merge of its current state with the changes\n> from the branch, minus any associated commits.\n>\n> I probably should have just used git-stash to tuck those changes away,\n> but I didn't.\n\nRather than spending time worrying about optimal ways to do this,\nwouldn't it work just to do merge (to get the right tree) followed by\nrebase -i to get the commits in the way you want (removing the merge,\nanyway)?\n\n[...]\n"},{"id":"126994","messageId":"7v8wejzgim.fsf@alter.siamese.dyndns.org","threadId":"21499","inReplyTo":"e2a1d0aa0911060653t7bbb54ebp948eac0dffeaba64@mail.gmail.com","subject":"Re: How to merge into my working copy?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-06T17:53:37Z","receivedAt":"2009-11-06T17:53:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Doyle <wpdster@gmail.com> writes:\n\n> I would like to pull a set of changes from a branch back into the\n> working copy of my current branch without affecting the index.  I\n> can't figure out the right combination of --commit, --no-commit, -ff,\n> -no-ff, --log, --no-log, --squash, --no-squash, etc... options to use\n> with git-merge.\n>\n> Basically, I created a branch off my mainline branch a few days ago.\n> Made some commits on that branch.  Then went back to my mainline\n> branch, made a few commits there, and now I would like to make my\n> working copy look like a merge of its current state with the changes\n> from the branch, minus any associated commits.\n\nIf you do not have to have your extra \"without affecting the index\"\nconstraint (which I do not see a sensible reason to want to, by the way),\nyou can \"merge --no-commit that_branch\", I think.\n"},{"id":"126997","messageId":"e2a1d0aa0911061015o412f1ab0k9fbfdb88431d49c9@mail.gmail.com","threadId":"21499","inReplyTo":"7v8wejzgim.fsf@alter.siamese.dyndns.org","subject":"Re: How to merge into my working copy?","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2009-11-06T18:15:37Z","receivedAt":"2009-11-06T18:15:37Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"On Fri, Nov 6, 2009 at 12:53 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> If you do not have to have your extra \"without affecting the index\"\n> constraint (which I do not see a sensible reason to want to, by the way),\n> you can \"merge --no-commit that_branch\", I think.\n>\n\nAfter bouncing this around a couple of times with Bruce Stephens, and\nonly now noticing that I hit \"Reply\" instead of \"Reply-All\"... sigh),\nI realized that what I wanted was:\n\n$ git merge --squash that_branch\n$ git reset\n\nI only wanted to affect my working copy, editing and adding things to\nthe index (which I think of as \"staging area for my next commit\") as I\nwas ready.\n\n--wpd\n"}]}