{"thread":{"id":"1441","subject":"cogito - how to drop a commit","startedAt":"2005-08-06T22:34:36Z","lastAt":"2005-08-11T21:59:53Z","messageCount":3,"participants":["Sam Ravnborg","Linus Torvalds","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"6890","messageId":"20050806223436.GA6495@mars.ravnborg.org","threadId":"1441","inReplyTo":null,"subject":"cogito - how to drop a commit","fromName":"Sam Ravnborg","fromEmail":"sam@ravnborg.org","sentAt":"2005-08-06T22:34:36Z","receivedAt":"2005-08-06T22:34:36Z","isPatch":false,"sender":{"key":"sam@ravnborg.org","avatar":"https://gravatar.com/avatar/168a912606ed0742d840bb365e3cc21db390c36531a58341dc7a069cc1f15f62?d=mp&s=160"},"body":"I accidently commited too many files to my tree today, and now I want to\ndrop the commit so I have logically separate commits.\n\nWhat is the right way to do this - in cogito hopefully.\n\nI do not mind to execute a few git commands, but for my daily usage I\nexpect cogito to hanle everything and dropping a commit has proved\nuseful for me from time to time, so I expect it be be implemented in the\nporcelain somehow.\n\nI have read the help for cg-seek - but it di not convince me to be what\nI seeked.\n\n\tSam\n"},{"id":"6892","messageId":"Pine.LNX.4.58.0508061727000.3258@g5.osdl.org","threadId":"1441","inReplyTo":"20050806223436.GA6495@mars.ravnborg.org","subject":"Re: cogito - how to drop a commit","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-07T00:42:14Z","receivedAt":"2005-08-07T00:42:14Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 7 Aug 2005, Sam Ravnborg wrote:\n>\n> I accidently commited too many files to my tree today, and now I want to\n> drop the commit so I have logically separate commits.\n> \n> What is the right way to do this - in cogito hopefully.\n\nNot cogito, and this needs to be scripted, but if what you _want_ to do is\nundo the commit (in order to re-do it as several commits), here are the\nraw git commands necessary (you could make this \"git-fix-script\", and then\n\"git fix\"  basically does the git equivalent of what \"bk fix -C\" did)\n\n\t# Set up\n\t#\n\t. git-sh-setup-script || die \"Not a git archive\"\n\n\t# Figure out the parent.\n\t#\n\tparent=$(git-rev-parse --verify HEAD^) || exit\n\n\t#\n\t# Update the index to be at that point in time and make HEAD \n\t# point to it, but don't update the working tree contents (ie\n\t# the changes remain in the working tree, to be re-committed).\n\t#\n\tgit-read-tree -f -m $parent && echo $parent > .git/HEAD\n\nNOTE! The commit still _exists_, but the HEAD reference to it is now lost.  \nIf you want to save that as a broken branch, you can precede this with\n\n\tgit branch broken-branch\n\nwhich means that the broken point got saved off as \"broken-branch\".\n\nAnd if you didn't do that (or if you _did_ do that, and later end up \ndeciding to throw that branch away with a\n\n\trm .git/refs/heads/broken-branch\n\nor similar) then you can get rid of the stale and unreachable objects with\na simple \"git prune\".\n\nBe careful! \"git prune\" _will_ throw away all the objects that it can't \nfind references to. You might want to run \"git-fsck-cache --full \n--unreachable\" first to get an idea of what it's going to throw away.\n\n\t\t\tLinus\n"},{"id":"7078","messageId":"20050811215952.GF25280@pasky.ji.cz","threadId":"1441","inReplyTo":"20050806223436.GA6495@mars.ravnborg.org","subject":"Re: cogito - how to drop a commit","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-08-11T21:59:53Z","receivedAt":"2005-08-11T21:59:53Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Aug 07, 2005 at 12:34:36AM CEST, I got a letter\nwhere Sam Ravnborg <sam@ravnborg.org> told me that...\n> I accidently commited too many files to my tree today, and now I want to\n> drop the commit so I have logically separate commits.\n> \n> What is the right way to do this - in cogito hopefully.\n> \n> I do not mind to execute a few git commands, but for my daily usage I\n> expect cogito to hanle everything and dropping a commit has proved\n> useful for me from time to time, so I expect it be be implemented in the\n> porcelain somehow.\n> \n> I have read the help for cg-seek - but it di not convince me to be what\n> I seeked.\n\ncg-admin-uncommit, be sure to read --help first. Linus' pruning notes\napply as well, cg-admin-uncommit won't delete it from the database\n(I personally don't care about that and never pruned so far).\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"}]}