{"thread":{"id":"17140","subject":"how to combine 2 commits?","startedAt":"2009-01-13T04:54:22Z","lastAt":"2009-01-13T11:32:49Z","messageCount":9,"participants":["bill lam","Jeff Whiteside","Boyd Stephen Smith Jr.","Imran M Yousuf","Sitaram Chamarty","Matthieu Moy","Stephen R. van den Berg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"100233","messageId":"20090113045422.GA6940@b2j","threadId":"17140","inReplyTo":null,"subject":"how to combine 2 commits?","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2009-01-13T04:54:22Z","receivedAt":"2009-01-13T04:54:22Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"Sorry I don't know the correct git terminology for it.  I make some\nchanges to scripts but also accidentally changed all scripts to use\ndos linefeed.  Failed to notice this and commit all changes. Then I\ntried to correct it by changing all scripts back to unix linefeed and commit again.\n\nHow to combine these 2 commits so that the changes of linefeed cancel\nout each other and the history only shows the intended changes of the\nfew scripts.\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n唐詩234 李白  怨情\n    美人捲珠簾  深坐蹙蛾眉  但見淚痕濕  不知心恨誰\n"},{"id":"100235","messageId":"3ab397d0901122108t7ae465feocd09b73ce4d525b2@mail.gmail.com","threadId":"17140","inReplyTo":"20090113045422.GA6940@b2j","subject":"Re: how to combine 2 commits?","fromName":"Jeff Whiteside","fromEmail":"jeff.m.whiteside@gmail.com","sentAt":"2009-01-13T05:08:32Z","receivedAt":"2009-01-13T05:08:32Z","isPatch":false,"sender":{"key":"jeff.m.whiteside@gmail.com","avatar":null},"body":"git terminology is \"squash\"\n\nOn Mon, Jan 12, 2009 at 11:54 PM, bill lam <cbill.lam@gmail.com> wrote:\n>\n> Sorry I don't know the correct git terminology for it.  I make some\n> changes to scripts but also accidentally changed all scripts to use\n> dos linefeed.  Failed to notice this and commit all changes. Then I\n> tried to correct it by changing all scripts back to unix linefeed and commit again.\n>\n> How to combine these 2 commits so that the changes of linefeed cancel\n> out each other and the history only shows the intended changes of the\n> few scripts.\n>\n> --\n> regards,\n> ====================================================\n> GPG key 1024D/4434BAB3 2008-08-24\n> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n> 唐��234 李白  怨情\n>    美人�灾楹�  深坐蹙蛾眉  但���I痕��  不知心恨�l\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"},{"id":"100236","messageId":"200901122327.21102.bss@iguanasuicide.net","threadId":"17140","inReplyTo":"20090113045422.GA6940@b2j","subject":"Re: how to combine 2 commits?","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss@iguanasuicide.net","sentAt":"2009-01-13T05:27:16Z","receivedAt":"2009-01-13T05:27:16Z","isPatch":false,"sender":{"key":"bss@iguanasuicide.net","avatar":"https://gravatar.com/avatar/84b95eeff194b816c1568b1339e63e4b229825298664a9037b9f1ec713ead1e3?d=mp&s=160"},"body":"On Monday 12 January 2009, bill lam <cbill.lam@gmail.com> wrote about 'how \nto combine 2 commits?':\n>How to combine these 2 commits so that the changes of linefeed cancel\n>out each other and the history only shows the intended changes of the\n>few scripts.\n\nTwo ways I can think of:\ngit rebase --interactive (read \"git help rebase\" first)\ngit merge --squash (read \"git help merge\" first)\n\nThe rebase is probably semantically closer to how you are thinking about \nthings right now.\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss@iguanasuicide.net                     ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.net/                      \\_/     \n"},{"id":"100237","messageId":"7bfdc29a0901122132l38837b37h188a8f5dd5ccbbd7@mail.gmail.com","threadId":"17140","inReplyTo":"200901122327.21102.bss@iguanasuicide.net","subject":"Re: how to combine 2 commits?","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2009-01-13T05:32:05Z","receivedAt":"2009-01-13T05:32:05Z","isPatch":false,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"On Tue, Jan 13, 2009 at 11:27 AM, Boyd Stephen Smith Jr.\n<bss@iguanasuicide.net> wrote:\n> On Monday 12 January 2009, bill lam <cbill.lam@gmail.com> wrote about 'how\n> to combine 2 commits?':\n>>How to combine these 2 commits so that the changes of linefeed cancel\n>>out each other and the history only shows the intended changes of the\n>>few scripts.\n>\n> Two ways I can think of:\n> git rebase --interactive (read \"git help rebase\" first)\n> git merge --squash (read \"git help merge\" first)\n>\n> The rebase is probably semantically closer to how you are thinking about\n> things right now.\n\nAnother way I can think of is - git format-patch + git apply, i.e.\nfirst generate 2 patches for the 2 commits and then apply them one on\ntop of another.\n\nBest regards,\n\nImran\n\n> --\n> Boyd Stephen Smith Jr.                     ,= ,-_-. =.\n> bss@iguanasuicide.net                     ((_/)o o(\\_))\n> ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-'\n> http://iguanasuicide.net/                      \\_/\n>\n\n\n\n-- \nImran M Yousuf\nEntrepreneur & Software Engineer\nSmart IT Engineering\nDhaka, Bangladesh\nEmail: imran@smartitengineering.com\nBlog: http://imyousuf-tech.blogs.smartitengineering.com/\nMobile: +880-1711402557\n"},{"id":"100239","messageId":"slrngmodgv.ple.sitaramc@sitaramc.homelinux.net","threadId":"17140","inReplyTo":"20090113045422.GA6940@b2j","subject":"Re: how to combine 2 commits?","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-01-13T06:35:11Z","receivedAt":"2009-01-13T06:35:11Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-01-13, bill lam <cbill.lam@gmail.com> wrote:\n> Sorry I don't know the correct git terminology for it.  I make some\n> changes to scripts but also accidentally changed all scripts to use\n> dos linefeed.  Failed to notice this and commit all changes. Then I\n> tried to correct it by changing all scripts back to unix\n> linefeed and commit again.\n>\n> How to combine these 2 commits so that the changes of linefeed cancel\n> out each other and the history only shows the intended changes of the\n> few scripts.\n\nI tend to make lots of small commits on the work tree, and\nhaving to combine them meaningfully later.\n\nI like using \"git rebase -i HEAD~5\" (if I want to rebase the\nlast 5 commits).  In the editor that pops up, I reorder the\nones that I know should be together, and on each set to be\nsquashed, I change the \"pick\" to \"s\" (for squash) on all but\nthe first one.  Save the file and it's all done.\n\nWorks like a charm.  For me, moving commits around in an\neditor, deleting them even, is very intuitive.\n"},{"id":"100241","messageId":"vpqiqojpuqn.fsf@bauges.imag.fr","threadId":"17140","inReplyTo":"slrngmodgv.ple.sitaramc@sitaramc.homelinux.net","subject":"Re: how to combine 2 commits?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-01-13T06:48:00Z","receivedAt":"2009-01-13T06:48:00Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Sitaram Chamarty <sitaramc@gmail.com> writes:\n\n> I like using \"git rebase -i HEAD~5\" (if I want to rebase the\n> last 5 commits).  In the editor that pops up, I reorder the\n> ones that I know should be together, and on each set to be\n> squashed, I change the \"pick\" to \"s\" (for squash) on all but\n> the first one.  Save the file and it's all done.\n\nAnd right after, you probably want to do stg like\n\n  git diff master@{1} master\n\nto see whether you actually changed the result by reordering your\npatches.\n\n-- \nMatthieu\n"},{"id":"100244","messageId":"20090113075121.GA6923@b2j","threadId":"17140","inReplyTo":"200901122327.21102.bss@iguanasuicide.net","subject":"Re: how to combine 2 commits?","fromName":"bill lam","fromEmail":"cbill.lam@gmail.com","sentAt":"2009-01-13T07:51:21Z","receivedAt":"2009-01-13T07:51:21Z","isPatch":false,"sender":{"key":"cbill.lam@gmail.com","avatar":null},"body":"On Mon, 12 Jan 2009, Boyd Stephen Smith Jr. wrote:\n> git rebase --interactive (read \"git help rebase\" first)\n\nI tried rebase the last 3 commit, but it failed.\n\nbill@b2j:jproject$ git log --pretty=oneline | head\n39ed365c11391bede0e1b6578adfac6619b78c0a for yajpp to use unix LF\n70c812db2439bc84a8dd7ea831067b9ebf29885c revert last crlf error\nf338a768d635b868e6fddaae670ad91d46ea7c4e format scripts   \n\nbill@b2j:jproject$ git rebase -i HEAD~3\nerror: Entry 'trunk/jcalc/mmenu-mm.ijs' not uptodate. Cannot merge.\nfatal: merging of trees a1eafe6cdbb428f851d6ca878bbc53149fb7e7eb and\na00e6dcd3ec3f4ffde0d1aad1958db724093de69 failed\n\nCould not apply 70c812d... revert last crlf error\n\nIt looks like cannot resolve conflict of linefeed changes. It was\nexpected all scripts will conflict, so I have to abort the rebase.\n\nWhat is the procedure to generate a patch of the HEAD from HEAD~4,\nthen cancel all changes from HEAD~3 up to HEAD, and then apply the\npatch to the previous HEAD~4 ?\n\nBTW, what is the norm of reply in this list, should it be reply to\nlist only, or reply to group (list plus all cc)?\n\n-- \nregards,\n====================================================\nGPG key 1024D/4434BAB3 2008-08-24\ngpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3\n唐詩213 李商隱  無題二首之二\n    颯颯東風細雨來  芙蓉塘外有輕雷  金蟾齧璅燒香入  玉虎牽絲汲井迴\n    賈氏窺簾韓掾少  宓妃留枕魏王才  春心莫共花爭發  一寸想思一寸灰\n"},{"id":"100265","messageId":"20090113112020.GC4243@cuci.nl","threadId":"17140","inReplyTo":"20090113075121.GA6923@b2j","subject":"Re: how to combine 2 commits?","fromName":"Stephen R. van den Berg","fromEmail":"srb@cuci.nl","sentAt":"2009-01-13T11:20:20Z","receivedAt":"2009-01-13T11:20:20Z","isPatch":false,"sender":{"key":"srb@cuci.nl","avatar":"https://gravatar.com/avatar/f75389059e827634d38e9df2a9b6ecbd50028b5a454442efa1c7205b7ff29c6a?d=mp&s=160"},"body":"bill lam wrote:\n>BTW, what is the norm of reply in this list, should it be reply to\n>list only, or reply to group (list plus all cc)?\n\nThis list prefers list plus all cc.\n-- \nSincerely,\n           Stephen R. van den Berg.\n\n\"I have a *cunning* plan!\"\n"},{"id":"100267","messageId":"slrngmouv1.9mk.sitaramc@sitaramc.homelinux.net","threadId":"17140","inReplyTo":"vpqiqojpuqn.fsf@bauges.imag.fr","subject":"Re: how to combine 2 commits?","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-01-13T11:32:49Z","receivedAt":"2009-01-13T11:32:49Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-01-13, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:\n> Sitaram Chamarty <sitaramc@gmail.com> writes:\n>\n>> I like using \"git rebase -i HEAD~5\" (if I want to rebase the\n>> last 5 commits).  In the editor that pops up, I reorder the\n>> ones that I know should be together, and on each set to be\n>> squashed, I change the \"pick\" to \"s\" (for squash) on all but\n>> the first one.  Save the file and it's all done.\n>\n> And right after, you probably want to do stg like\n>\n>   git diff master@{1} master\n>\n> to see whether you actually changed the result by reordering your\n> patches.\n\nI used to do that, but now I've stopped.  If it doesn't\nconflict, I know it's good.  I go straight to the equivalent\nof make && make test.\n\nI must mention though, that I don't reorder the relative\nsequences of commits affecting the same file/set of files.\nThat might have something to do with my confidence :-)\n"}]}