{"thread":{"id":"22026","subject":"Set the repository as it was on an earlier commit","startedAt":"2009-12-25T23:09:24Z","lastAt":"2009-12-28T05:18:03Z","messageCount":6,"participants":["Sergio Belkin","Steven Noonan","Santi Béjar","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"130340","messageId":"8c6f7f450912251509i67da4665t78be0bb79f2c40d6@mail.gmail.com","threadId":"22026","inReplyTo":null,"subject":"Set the repository as it was on an earlier commit","fromName":"Sergio Belkin","fromEmail":"sebelk@gmail.com","sentAt":"2009-12-25T23:09:24Z","receivedAt":"2009-12-25T23:09:24Z","isPatch":false,"sender":{"key":"sebelk@gmail.com","avatar":"https://gravatar.com/avatar/bfef5af94e875d448c5126a7ebd1759adccb46c10595d3d996efec02bb6b9367?d=mp&s=160"},"body":"Hi,\n\nFirstly merry Christmas everyone.\n\nI am somewhat new to git, and I've found great, but still I have some\ndoubts about it, let's say I have the following repo with:\n\nA---B---C---D\n\nBeing A the first commit,  B the second one an D the last one.\n\nHow I do to go back to let's say... B commit status, I mean somewhat as follows:\n\nA---B---C---D---B'\n\nB' would be the same as B. I am not asking to do something so:\n\nA---B---C---D to A---B losing C and D commits,\n\nI'd like to keep on history C and D commits, can git to do that?\n\nThanks in advance!\n\n-- \n--\nOpen Kairos http://www.sergiobelkin.com\nWatch More TV http://sebelk.blogspot.com\nSergio Belkin -\n"},{"id":"130341","messageId":"f488382f0912251524i12bf53a4xf381606705abff4b@mail.gmail.com","threadId":"22026","inReplyTo":"8c6f7f450912251509i67da4665t78be0bb79f2c40d6@mail.gmail.com","subject":"Re: Set the repository as it was on an earlier commit","fromName":"Steven Noonan","fromEmail":"steven@uplinklabs.net","sentAt":"2009-12-25T23:24:59Z","receivedAt":"2009-12-25T23:24:59Z","isPatch":false,"sender":{"key":"steven@uplinklabs.net","avatar":"https://gravatar.com/avatar/b0cd397a10638433f76e084531aa0af3bef85f8fdb59b1ebe2ddaf168cd100e9?d=mp&s=160"},"body":"On Fri, Dec 25, 2009 at 3:09 PM, Sergio Belkin <sebelk@gmail.com> wrote:\n> Hi,\n>\n> Firstly merry Christmas everyone.\n>\n> I am somewhat new to git, and I've found great, but still I have some\n> doubts about it, let's say I have the following repo with:\n>\n> A---B---C---D\n>\n> Being A the first commit,  B the second one an D the last one.\n>\n> How I do to go back to let's say... B commit status, I mean somewhat as follows:\n>\n> A---B---C---D---B'\n>\n> B' would be the same as B. I am not asking to do something so:\n>\n> A---B---C---D to A---B losing C and D commits,\n>\n> I'd like to keep on history C and D commits, can git to do that?\n>\n> Thanks in advance!\n>\n\ngit revert D\ngit revert C\n\nMaybe? It would create two revert commits, but it would get you back\nto the state of B.\n\n- Steven\n"},{"id":"130342","messageId":"adf1fd3d0912251536kbf25272ob0ab8ee90e53861d@mail.gmail.com","threadId":"22026","inReplyTo":"8c6f7f450912251509i67da4665t78be0bb79f2c40d6@mail.gmail.com","subject":"Re: Set the repository as it was on an earlier commit","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-12-25T23:36:24Z","receivedAt":"2009-12-25T23:36:24Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Sat, Dec 26, 2009 at 12:09 AM, Sergio Belkin <sebelk@gmail.com> wrote:\n> Hi,\n>\n> Firstly merry Christmas everyone.\n>\n> I am somewhat new to git, and I've found great, but still I have some\n> doubts about it, let's say I have the following repo with:\n>\n> A---B---C---D\n>\n> Being A the first commit,  B the second one an D the last one.\n>\n> How I do to go back to let's say... B commit status, I mean somewhat as follows:\n>\n> A---B---C---D---B'\n>\n> B' would be the same as B. I am not asking to do something so:\n>\n> A---B---C---D to A---B losing C and D commits,\n>\n> I'd like to keep on history C and D commits, can git to do that?\n\nI don't know if it is possible with porcelain commands, but with\nplumbing you can:\n\n# begin with a clean working dir\ngit read-tree B\ngit commit\ngit reset --hard\n\nHTH,\nSanti\n"},{"id":"130346","messageId":"vpqiqbt95e7.fsf@bauges.imag.fr","threadId":"22026","inReplyTo":"adf1fd3d0912251536kbf25272ob0ab8ee90e53861d@mail.gmail.com","subject":"Re: Set the repository as it was on an earlier commit","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-12-26T14:28:00Z","receivedAt":"2009-12-26T14:28:00Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Santi Béjar <santi@agolina.net> writes:\n\n> I don't know if it is possible with porcelain commands, but with\n> plumbing you can:\n>\n> # begin with a clean working dir\n> git read-tree B\n> git commit\n> git reset --hard\n\nI guess\n\n(at the root of the repo)\n\ngit checkout B -- .\n# git status if you want to check.\ngit commit\n\ndoes this. The \"-- .\" part of \"git checkout\" asks Git to checkout the\nfiles, but the path limiter prevents it from updating HEAD, so the\nHEAD still points to the tip of the branch.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"130383","messageId":"8c6f7f450912272019t4b9c721dt2630a8d32607013e@mail.gmail.com","threadId":"22026","inReplyTo":"vpqiqbt95e7.fsf@bauges.imag.fr","subject":"Re: Set the repository as it was on an earlier commit","fromName":"Sergio Belkin","fromEmail":"sebelk@gmail.com","sentAt":"2009-12-28T04:19:29Z","receivedAt":"2009-12-28T04:19:29Z","isPatch":false,"sender":{"key":"sebelk@gmail.com","avatar":"https://gravatar.com/avatar/bfef5af94e875d448c5126a7ebd1759adccb46c10595d3d996efec02bb6b9367?d=mp&s=160"},"body":"2009/12/26 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:\n> Santi Béjar <santi@agolina.net> writes:\n>\n>> I don't know if it is possible with porcelain commands, but with\n>> plumbing you can:\n>>\n>> # begin with a clean working dir\n>> git read-tree B\n>> git commit\n>> git reset --hard\n>\n> I guess\n>\n> (at the root of the repo)\n>\n> git checkout B -- .\n> # git status if you want to check.\n> git commit\n>\n> does this. The \"-- .\" part of \"git checkout\" asks Git to checkout the\n> files, but the path limiter prevents it from updating HEAD, so the\n> HEAD still points to the tip of the branch.\n>\n> --\n> Matthieu Moy\n> http://www-verimag.imag.fr/~moy/\n>\n\nSorry but really answer given by Steven was better, because last one\nomit the case when B had less files that D for example...\n\nThanks everyone\n\n-- \n--\nOpen Kairos http://www.sergiobelkin.com\nWatch More TV http://sebelk.blogspot.com\nSergio Belkin -\n"},{"id":"130386","messageId":"8c6f7f450912272118x384cd840j238b39efa9a87a3b@mail.gmail.com","threadId":"22026","inReplyTo":"8c6f7f450912272019t4b9c721dt2630a8d32607013e@mail.gmail.com","subject":"Fwd: Set the repository as it was on an earlier commit","fromName":"Sergio Belkin","fromEmail":"sebelk@gmail.com","sentAt":"2009-12-28T05:18:03Z","receivedAt":"2009-12-28T05:18:03Z","isPatch":false,"sender":{"key":"sebelk@gmail.com","avatar":"https://gravatar.com/avatar/bfef5af94e875d448c5126a7ebd1759adccb46c10595d3d996efec02bb6b9367?d=mp&s=160"},"body":"Ooops I wanted to say Santi answer was the best\n\n\n---------- Forwarded message ----------\nFrom: Sergio Belkin <sebelk@gmail.com>\nDate: 2009/12/28\nSubject: Re: Set the repository as it was on an earlier commit\nTo: git@vger.kernel.org\n\n\n2009/12/26 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:\n> Santi Béjar <santi@agolina.net> writes:\n>\n>> I don't know if it is possible with porcelain commands, but with\n>> plumbing you can:\n>>\n>> # begin with a clean working dir\n>> git read-tree B\n>> git commit\n>> git reset --hard\n>\n> I guess\n>\n> (at the root of the repo)\n>\n> git checkout B -- .\n> # git status if you want to check.\n> git commit\n>\n> does this. The \"-- .\" part of \"git checkout\" asks Git to checkout the\n> files, but the path limiter prevents it from updating HEAD, so the\n> HEAD still points to the tip of the branch.\n>\n> --\n> Matthieu Moy\n> http://www-verimag.imag.fr/~moy/\n>\n\nSorry but really answer given by Steven was better, because last one\nomit the case when B had less files that D for example...\n\nThanks everyone\n\n--\n--\nOpen Kairos http://www.sergiobelkin.com\nWatch More TV http://sebelk.blogspot.com\nSergio Belkin -\n\n\n\n-- \n--\nOpen Kairos http://www.sergiobelkin.com\nWatch More TV http://sebelk.blogspot.com\nSergio Belkin -\n"}]}