{"thread":{"id":"21329","subject":"Any way to \"flatten\" a series of changes in git","startedAt":"2009-10-22T20:03:44Z","lastAt":"2009-10-26T13:42:23Z","messageCount":14,"participants":["Howard Miller","Bill Lear","Jacob Helwig","Jakub Narebski","Johannes Sixt","Junio C Hamano","Daniele Segato"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"125732","messageId":"26ae428a0910221303n493fb7s701269d694110685@mail.gmail.com","threadId":"21329","inReplyTo":null,"subject":"Any way to \"flatten\" a series of changes in git","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-22T20:03:44Z","receivedAt":"2009-10-22T20:03:44Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"Hello,\n\nI have a branch with a whole series of commits. I want to export this\nwork to be customer (to their svn repo if that has any bearing on it).\nAll the stuff in the history is irrelevant to my customer (\"committing\nnow, going to bed\" etc.) so I'd like to create a new branch that only\nhas one commit.. the end point with a new message. Is this possible?\n\nThanks again!\n"},{"id":"125733","messageId":"19168.49405.775024.649626@lisa.zopyra.com","threadId":"21329","inReplyTo":"26ae428a0910221303n493fb7s701269d694110685@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2009-10-22T20:30:53Z","receivedAt":"2009-10-22T20:30:53Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Thursday, October 22, 2009 at 21:03:44 (+0100) Howard Miller writes:\n>Hello,\n>\n>I have a branch with a whole series of commits. I want to export this\n>work to be customer (to their svn repo if that has any bearing on it).\n>All the stuff in the history is irrelevant to my customer (\"committing\n>now, going to bed\" etc.) so I'd like to create a new branch that only\n>has one commit.. the end point with a new message. Is this possible?\n\ngit rebase is your friend.\n\n\nBill\n"},{"id":"125738","messageId":"19168.50232.47935.864407@lisa.zopyra.com","threadId":"21329","inReplyTo":"19168.49405.775024.649626@lisa.zopyra.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2009-10-22T20:44:40Z","receivedAt":"2009-10-22T20:44:40Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Thursday, October 22, 2009 at 15:30:53 (-0500) Bill Lear writes:\n>On Thursday, October 22, 2009 at 21:03:44 (+0100) Howard Miller writes:\n>>Hello,\n>>\n>>I have a branch with a whole series of commits. I want to export this\n>>work to be customer (to their svn repo if that has any bearing on it).\n>>All the stuff in the history is irrelevant to my customer (\"committing\n>>now, going to bed\" etc.) so I'd like to create a new branch that only\n>>has one commit.. the end point with a new message. Is this possible?\n>\n>git rebase is your friend.\n\nSomeone correct me if I'm wrong.\n\n% git branch\n* master\n% git checkout -b my_work_branch\n% [work work work, commit, commit, commit]\n% git rebase -i master\n\nYou'll then get an editor buffer that looks like this:\n\npick 16730c6 baz 0\npick 2a844e7 baz 1\npick d6e71dc baz 2\npick d1a6995 baz 3\npick 157e675 baz 4\n\n# Rebase ef0a89e..157e675 onto ef0a89e\n#\n# Commands:\n#  p, pick = use commit\n#  e, edit = use commit, but stop for amending\n#  s, squash = use commit, but meld into previous commit\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n# However, if you remove everything, the rebase will be aborted.\n#\n\nEdit this to keep what you need:\npick 16730c6 baz 0\nsquash 2a844e7 baz 1\nsquash d6e71dc baz 2\nsquash d1a6995 baz 3\nsquash 157e675 baz 4\n\nthen exit the editor.  It'll pop you in another editor session to\ntype in a commit message for these, just type in what you need and\nexit and you'll have the new commit with all the olds ones squashed\ninto it.\n\n\nBill\n"},{"id":"125739","messageId":"8c9a060910221351w12e6c610kb842263e1c02ea63@mail.gmail.com","threadId":"21329","inReplyTo":"19168.50232.47935.864407@lisa.zopyra.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2009-10-22T20:51:01Z","receivedAt":"2009-10-22T20:51:01Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Thu, Oct 22, 2009 at 13:44, Bill Lear <rael@zopyra.com> wrote:\n> On Thursday, October 22, 2009 at 15:30:53 (-0500) Bill Lear writes:\n>>On Thursday, October 22, 2009 at 21:03:44 (+0100) Howard Miller writes:\n>>>Hello,\n>>>\n>>>I have a branch with a whole series of commits. I want to export this\n>>>work to be customer (to their svn repo if that has any bearing on it).\n>>>All the stuff in the history is irrelevant to my customer (\"committing\n>>>now, going to bed\" etc.) so I'd like to create a new branch that only\n>>>has one commit.. the end point with a new message. Is this possible?\n>>\n>>git rebase is your friend.\n>\n> Someone correct me if I'm wrong.\n>\n> % git branch\n> * master\n> % git checkout -b my_work_branch\n> % [work work work, commit, commit, commit]\n> % git rebase -i master\n>\n\nAlternatively, you could use git merge --squash\n\ngit checkout master\ngit merge --squash topic\n\nSee git-merge(1) for details.\n\nrebase --interactive it excellent for cleaning up history, especially\nif you want to end up with more than one commit at the end.  merge\n--squash is usually sufficient if all you need is one commit at the\nend.\n"},{"id":"125740","messageId":"26ae428a0910221358r47434b4uf7ec71f9376b9f75@mail.gmail.com","threadId":"21329","inReplyTo":"8c9a060910221351w12e6c610kb842263e1c02ea63@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-22T20:58:03Z","receivedAt":"2009-10-22T20:58:03Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":">\n> Alternatively, you could use git merge --squash\n>\n> git checkout master\n> git merge --squash topic\n>\n> See git-merge(1) for details.\n>\n> rebase --interactive it excellent for cleaning up history, especially\n> if you want to end up with more than one commit at the end.  merge\n> --squash is usually sufficient if all you need is one commit at the\n> end.\n>\n\nBrilliant, thanks everybody!! I'll go and back up my database and have\na play with these options.\n"},{"id":"125741","messageId":"m3hbtrdu1r.fsf@localhost.localdomain","threadId":"21329","inReplyTo":"26ae428a0910221303n493fb7s701269d694110685@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-10-22T20:59:15Z","receivedAt":"2009-10-22T20:59:15Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Howard Miller <howard@e-learndesign.co.uk> writes:\n\n> I have a branch with a whole series of commits. I want to export this\n> work to be customer (to their svn repo if that has any bearing on it).\n> All the stuff in the history is irrelevant to my customer (\"committing\n> now, going to bed\" etc.) so I'd like to create a new branch that only\n> has one commit.. the end point with a new message. Is this possible?\n\nYou can use either \"git merge --squash\" or \"git rebase --interactive\"\n(changing 'pick' to 'squash').\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"125742","messageId":"26ae428a0910221411l73aa7cbak5c060925ccdf4cea@mail.gmail.com","threadId":"21329","inReplyTo":"m3hbtrdu1r.fsf@localhost.localdomain","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-22T21:11:07Z","receivedAt":"2009-10-22T21:11:07Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"> You can use either \"git merge --squash\" or \"git rebase --interactive\"\n> (changing 'pick' to 'squash').\n>\n\nActually thinking some more.... I don't understand something about\nthis. I don't actually want to merge or rebase with anything. I just\nwant to say \"make those commits a series of commits on a branch into\njust one commit with a new message\". I seriously suspect I'm missing\nthe point somewhere but what has that got to do with merging or\nrebasing?\n\nThanks again\n"},{"id":"125747","messageId":"26ae428a0910221424n9f45d9bg379fb6609b4eace0@mail.gmail.com","threadId":"21329","inReplyTo":"26ae428a0910221411l73aa7cbak5c060925ccdf4cea@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-22T21:24:22Z","receivedAt":"2009-10-22T21:24:22Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"2009/10/22 Howard Miller <howard@e-learndesign.co.uk>:\n>> You can use either \"git merge --squash\" or \"git rebase --interactive\"\n>> (changing 'pick' to 'squash').\n>>\n>\n> Actually thinking some more.... I don't understand something about\n> this. I don't actually want to merge or rebase with anything. I just\n> want to say \"make those commits a series of commits on a branch into\n> just one commit with a new message\". I seriously suspect I'm missing\n> the point somewhere but what has that got to do with merging or\n> rebasing?\n>\n> Thanks again\n>\n\nOh..... more reading of the help. It's this I take it...\n\n\" For example, if you want to reorder the last 5 commits, such that\nwhat was HEAD~4 becomes the new HEAD. To achieve that, you\n       would call git-rebase like this:\n\n           $ git rebase -i HEAD~5\"\n\nWould it be ungrateful to suggest that the existence of that option\nisn't clear from the synopsis at the start of the help? :-)   I guess\nI can put the SHA1 identifier of the first commit in my branch too?\nAnyway, I'll go and try it and see what happens.\n"},{"id":"125750","messageId":"200910222357.15189.jnareb@gmail.com","threadId":"21329","inReplyTo":"26ae428a0910221411l73aa7cbak5c060925ccdf4cea@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-10-22T21:57:14Z","receivedAt":"2009-10-22T21:57:14Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 22 Oct 2009, Howard Miller wrote:\n\n> > You can use either \"git merge --squash\" or \"git rebase --interactive\"\n> > (changing 'pick' to 'squash').\n> >\n> \n> Actually thinking some more.... I don't understand something about\n> this. I don't actually want to merge or rebase with anything. I just\n> want to say \"make those commits a series of commits on a branch into\n> just one commit with a new message\". I seriously suspect I'm missing\n> the point somewhere but what has that got to do with merging or\n> rebasing?\n\nActually using \"git merge --squash\" is a bit different from using\n\"git rebase --interactive\".\n\n\n1. \"git merge --squash\"\n\n>From documentation:\n\n  --squash::\n        Produce the working tree and index state as if a real\n        merge happened (except for the merge information),\n        but do not actually make a commit or\n        move the `HEAD`, nor record `$GIT_DIR/MERGE_HEAD` to\n        cause the next `git commit` command to create a merge\n        commit.  This allows you to create a single commit on\n        top of the current branch whose effect is the same as\n        merging another branch (or more in case of an octopus).\n\nThis means for example if you did your changes on a separate \ntopic branch, and you want to merge your changes into 'master'\nbranch, you would do\n\n  $ git checkout master\n  $ git merge side-branch\n\nwhich would result in the following history:\n\n\n   ---*---*---*---*---*---*---*---M         <-- master\n       \\                         /\n        \\-.---.---.---.---.---.-/           <-- side-branch\n\n\nIf you used '--squash' option to git-merge, because changes were\nmade in throwaway topic branch, and as you said only final result\nmatter, you would get:\n\n  $ git checkout master\n  $ git merge --squash side-branch\n\n   ---*---*---*---*---*---*---*---M'        <-- master\n       \\                         \n        \\-.---.---.---.---.---.             <-- side-branch\n\n\nwhere commit M' has the same contents (the same tree) as commit M\nin previous example, but is not a merge commit.\n\nIf you simply want to squash last say 5 commits into one, you can\nuse \"git merge --squash\" for it in the following way:\n\n  $ git reset --hard HEAD~5\n  $ git merge --squash --no-ff HEAD@{1}\n\nwhich means basically: rewind to state 5 commits back, then merge\nin changes from before rewind, squashing them.  The --no-ff is needed\nbecause otherwise it would be fast-forward and no commit would be\ncreated.\n\n\n2. \"git rebase --interactive\"\n\nThe interactive rebase is meant to edit commits being rebased, but\nit can be used simply to edit commits.  It includes 'squash' command\nthat can be used to concatenate (squash) commits.\n\nSo to squash last say 5 commits into one, you would use\n\n  $ git rebase --interactive HEAD~5\n\nthen edit provided list of commands and commits to read something like\nthis:\n\n   pick deadbee The oneline of this commit\n   squash fa1afe1 The oneline of the next commit\n   ...\n   squash beedead The oneline of the that commit\n\ni.e. replace 'pick' command by 'squash' command.\n\nThis is a very powerfull command, and can be used for example to turn\nseries of say 5 commits into series of say 2 commits; not simply squashing\nto a single commit, but reducing number of commits (and presumably\ncleaning up those commits).\n\n\nHTH (hope that helps)\n-- \nJakub Narebski\nPoland\n"},{"id":"125767","messageId":"26ae428a0910222236l58bc64b7l12c4cff09b086dac@mail.gmail.com","threadId":"21329","inReplyTo":"200910222357.15189.jnareb@gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-23T05:36:10Z","receivedAt":"2009-10-23T05:36:10Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"2009/10/22 Jakub Narebski <jnareb@gmail.com>:\n> On Thu, 22 Oct 2009, Howard Miller wrote:\n>\n>> > You can use either \"git merge --squash\" or \"git rebase --interactive\"\n>> > (changing 'pick' to 'squash').\n>> >\n>>\n>> Actually thinking some more.... I don't understand something about\n>> this. I don't actually want to merge or rebase with anything. I just\n>> want to say \"make those commits a series of commits on a branch into\n>> just one commit with a new message\". I seriously suspect I'm missing\n>> the point somewhere but what has that got to do with merging or\n>> rebasing?\n>\n> Actually using \"git merge --squash\" is a bit different from using\n> \"git rebase --interactive\".\n>\n>\n> 1. \"git merge --squash\"\n>\n> From documentation:\n>\n>  --squash::\n>        Produce the working tree and index state as if a real\n>        merge happened (except for the merge information),\n>        but do not actually make a commit or\n>        move the `HEAD`, nor record `$GIT_DIR/MERGE_HEAD` to\n>        cause the next `git commit` command to create a merge\n>        commit.  This allows you to create a single commit on\n>        top of the current branch whose effect is the same as\n>        merging another branch (or more in case of an octopus).\n>\n> This means for example if you did your changes on a separate\n> topic branch, and you want to merge your changes into 'master'\n> branch, you would do\n>\n>  $ git checkout master\n>  $ git merge side-branch\n>\n> which would result in the following history:\n>\n>\n>   ---*---*---*---*---*---*---*---M         <-- master\n>       \\                         /\n>        \\-.---.---.---.---.---.-/           <-- side-branch\n>\n>\n> If you used '--squash' option to git-merge, because changes were\n> made in throwaway topic branch, and as you said only final result\n> matter, you would get:\n>\n>  $ git checkout master\n>  $ git merge --squash side-branch\n>\n>   ---*---*---*---*---*---*---*---M'        <-- master\n>       \\\n>        \\-.---.---.---.---.---.             <-- side-branch\n>\n>\n> where commit M' has the same contents (the same tree) as commit M\n> in previous example, but is not a merge commit.\n>\n> If you simply want to squash last say 5 commits into one, you can\n> use \"git merge --squash\" for it in the following way:\n>\n>  $ git reset --hard HEAD~5\n>  $ git merge --squash --no-ff HEAD@{1}\n>\n> which means basically: rewind to state 5 commits back, then merge\n> in changes from before rewind, squashing them.  The --no-ff is needed\n> because otherwise it would be fast-forward and no commit would be\n> created.\n>\n>\n> 2. \"git rebase --interactive\"\n>\n> The interactive rebase is meant to edit commits being rebased, but\n> it can be used simply to edit commits.  It includes 'squash' command\n> that can be used to concatenate (squash) commits.\n>\n> So to squash last say 5 commits into one, you would use\n>\n>  $ git rebase --interactive HEAD~5\n>\n> then edit provided list of commands and commits to read something like\n> this:\n>\n>   pick deadbee The oneline of this commit\n>   squash fa1afe1 The oneline of the next commit\n>   ...\n>   squash beedead The oneline of the that commit\n>\n> i.e. replace 'pick' command by 'squash' command.\n>\n> This is a very powerfull command, and can be used for example to turn\n> series of say 5 commits into series of say 2 commits; not simply squashing\n> to a single commit, but reducing number of commits (and presumably\n> cleaning up those commits).\n>\n>\n> HTH (hope that helps)\n> --\n> Jakub Narebski\n> Poland\n>\n\nHi Jakub,\n\nYes it helps a lot. What I *don't* care about (or want to do) is\nactually do a merge or a rebase I just want to change history. Well,\nthat's what I thought I wanted. What I suppose I really want is the\nfull history for *me* and a second branch with the 'reduced' history\nto push to my client.  I suppose that's different yet again?\n\nHoward\n"},{"id":"125768","messageId":"26ae428a0910222240w7956e57dn325afcdd15aa2cb@mail.gmail.com","threadId":"21329","inReplyTo":"26ae428a0910222236l58bc64b7l12c4cff09b086dac@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-23T05:40:30Z","receivedAt":"2009-10-23T05:40:30Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":">\n> Hi Jakub,\n>\n> Yes it helps a lot. What I *don't* care about (or want to do) is\n> actually do a merge or a rebase I just want to change history. Well,\n> that's what I thought I wanted. What I suppose I really want is the\n> full history for *me* and a second branch with the 'reduced' history\n> to push to my client.  I suppose that's different yet again?\n>\n> Howard\n>\n\nActually, what I should have said in the first place is that this is\nspecifically nothing to do with the main trunk. We are doing small\ncustom developments for clients away from the main project\ndevelopment. So we specifically don't want to merge or rebase with the\nmaster - that's never going to happen. I want to keep the development\nbranch in tact for my reference, but when I push (the custom\ndevelopment branch) to the client I need that sanitized. I think I\nfinally have it clear in my own head now!\n\nHoward\n"},{"id":"125769","messageId":"4AE143BC.7040507@viscovery.net","threadId":"21329","inReplyTo":"26ae428a0910221411l73aa7cbak5c060925ccdf4cea@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-10-23T05:48:44Z","receivedAt":"2009-10-23T05:48:44Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Howard Miller schrieb:\n> Actually thinking some more.... I don't understand something about\n> this. I don't actually want to merge or rebase with anything. I just\n> want to say \"make those commits a series of commits on a branch into\n> just one commit with a new message\". I seriously suspect I'm missing\n> the point somewhere but what has that got to do with merging or\n> rebasing?\n\nThe easiest way (IMHO) to achieve this is certainly:\n\n  # start a new branch at the tip of the series\n  $ git checkout -b all-in-one the-series\n\n  # squash 17 commits\n  $ git reset --soft HEAD~17\n  $ git commit\n\nNow you have a new branch 'all-in-one' that has the same contents as the\noriginal series 'the-series', but with only one commit:\n\n  $ git diff the-series..all-in-one  # must show no differences\n\n-- Hannes\n"},{"id":"125772","messageId":"7v4opqeitj.fsf@alter.siamese.dyndns.org","threadId":"21329","inReplyTo":"4AE143BC.7040507@viscovery.net","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-23T06:16:24Z","receivedAt":"2009-10-23T06:16:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> The easiest way (IMHO) to achieve this is certainly:\n>\n>   # start a new branch at the tip of the series\n>   $ git checkout -b all-in-one the-series\n>\n>   # squash 17 commits\n>   $ git reset --soft HEAD~17\n>   $ git commit\n>\n> Now you have a new branch 'all-in-one' that has the same contents as the\n> original series 'the-series', but with only one commit:\n>\n>   $ git diff the-series..all-in-one  # must show no differences\n\nI think --squash \"*merge*\" is conceptually simpler to explain *and*\nhas an added advantage that it helps preparing the consolidated log\nmessage.\n\n    # start from the last customer dump\n    $ git checkout -b customer-update last-release\n    # give the customer the greatness in the series, content-wise\n    $ git merge --squash the-series\n    $ git commit\n\nThis will start the \"customer-update\" branch starting from the\nlast dump you gave to the customer, merge in the changes made\nin the series without history, and when you make a commit, you\nwill have access to all the individual log messages in the\nseries to look at as reference, so that you can cut and paste\nfrom them to summarized message instead of typing everything anew.\n"},{"id":"125928","messageId":"9accb4400910260642w360e2879vd3b1b1efc3613a13@mail.gmail.com","threadId":"21329","inReplyTo":"26ae428a0910221358r47434b4uf7ec71f9376b9f75@mail.gmail.com","subject":"Re: Any way to \"flatten\" a series of changes in git","fromName":"Daniele Segato","fromEmail":"daniele.bilug@gmail.com","sentAt":"2009-10-26T13:42:23Z","receivedAt":"2009-10-26T13:42:23Z","isPatch":false,"sender":{"key":"daniele.bilug@gmail.com","avatar":null},"body":"On Thu, Oct 22, 2009 at 9:58 PM, Howard Miller\n<howard@e-learndesign.co.uk> wrote:\n>> git merge --squash topic\n\n>> rebase --interactive it excellent for cleaning up history, especially [...]\n\n> Brilliant, thanks everybody!! I'll go and back up my database and have\n> a play with these options.\n\n\nI don't think you need it.\nwhen you rebase or squash git don't throw away your commits\n\nwhen I do things like that I usually create a new branch to do my tests\n\nif I'm happy with the result I can do\n\ngit checkout myRealBranch\ngit reset --hard myTestBranch\n# do the push/svn dcommit/whatever\n\nif I'm not happy I can start all over again just doing:\n\ngit checkout MyTestBranch\ngit reset --hard myRealBranch\n\nregards,\nDaniele\n"}]}