{"thread":{"id":"18541","subject":"reverting initial commit","startedAt":"2009-03-25T18:12:56Z","lastAt":"2009-03-25T21:22:43Z","messageCount":10,"participants":["Pascal Obry","Jacob Helwig","Junio C Hamano","Giuseppe Bilotta","Sverre Rabbelier","Eric Raible"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"109388","messageId":"49CA7428.70400@obry.net","threadId":"18541","inReplyTo":null,"subject":"reverting initial commit","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2009-03-25T18:12:56Z","receivedAt":"2009-03-25T18:12:56Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nStarting a new project I create a new repo and added some files for the\ninitial revision of the project, something like:\n\nmkdir repo.git\ncd repo.git\ngit init\ntouch file\ngit add file\ngit ci -m \"initial revision\"\n\nNow one file was not meant to be committed, I wanted to revert this commit:\n\ngit reset HEAD^\n\nfatal: ambiguous argument 'HEAD^': unknown revision or path not in the\nworking tree.\nUse '--' to separate paths from revisions\n\nI understand that HEAD^ does not exist, is there a way to do that?\n\nThanks,\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|    http://www.obry.net  -  http://v2p.fr.eu.org\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n"},{"id":"109390","messageId":"8c9a060903251120j3e757e94o96b2b77669c16c61@mail.gmail.com","threadId":"18541","inReplyTo":"49CA7428.70400@obry.net","subject":"Re: reverting initial commit","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2009-03-25T18:20:23Z","receivedAt":"2009-03-25T18:20:23Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Wed, Mar 25, 2009 at 11:12, Pascal Obry <pascal@obry.net> wrote:\n>\n> Starting a new project I create a new repo and added some files for the\n> initial revision of the project, something like:\n>\n> mkdir repo.git\n> cd repo.git\n> git init\n> touch file\n> git add file\n> git ci -m \"initial revision\"\n>\n> Now one file was not meant to be committed, I wanted to revert this commit:\n>\n> git reset HEAD^\n>\n> fatal: ambiguous argument 'HEAD^': unknown revision or path not in the\n> working tree.\n> Use '--' to separate paths from revisions\n>\n> I understand that HEAD^ does not exist, is there a way to do that?\n>\n> Thanks,\n> Pascal.\n>\n> --\n>\n> --|------------------------------------------------------\n> --| Pascal Obry                           Team-Ada Member\n> --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n> --|------------------------------------------------------\n> --|    http://www.obry.net  -  http://v2p.fr.eu.org\n> --| \"The best way to travel is by means of imagination\"\n> --|\n> --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n>\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>\n\nYou want \"git filter-branch\".  Probably something like:\n\ngit filter-branch --index-filter 'git rm --cached --ignore-unmatched\nFILE_TO_REMOVE' -- --all\n\nThis will remove FILE_TO_REMOVE from all commits across all branches.\n\n-Jacob\n"},{"id":"109391","messageId":"7v1vsl4fxo.fsf@gitster.siamese.dyndns.org","threadId":"18541","inReplyTo":"49CA7428.70400@obry.net","subject":"Re: reverting initial commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-25T18:26:27Z","receivedAt":"2009-03-25T18:26:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> Starting a new project I create a new repo and added some files for the\n> initial revision of the project, something like:\n>\n> mkdir repo.git\n> cd repo.git\n> git init\n> touch file\n> git add file\n> git ci -m \"initial revision\"\n>\n> Now one file was not meant to be committed, I wanted to revert this commit:\n\nThat's not even an revert.  Can't you simply amend it away?\n\n\t$ git rm not-this-file\n        $ git commit --amend\n"},{"id":"109392","messageId":"8c9a060903251133x33749041oc2a5152097da0ae8@mail.gmail.com","threadId":"18541","inReplyTo":"7v1vsl4fxo.fsf@gitster.siamese.dyndns.org","subject":"Re: reverting initial commit","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2009-03-25T18:33:34Z","receivedAt":"2009-03-25T18:33:34Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Wed, Mar 25, 2009 at 11:26, Junio C Hamano <gitster@pobox.com> wrote:\n> Pascal Obry <pascal@obry.net> writes:\n>\n>> Starting a new project I create a new repo and added some files for the\n>> initial revision of the project, something like:\n>>\n>> mkdir repo.git\n>> cd repo.git\n>> git init\n>> touch file\n>> git add file\n>> git ci -m \"initial revision\"\n>>\n>> Now one file was not meant to be committed, I wanted to revert this commit:\n>\n> That's not even an revert.  Can't you simply amend it away?\n>\n>        $ git rm not-this-file\n>        $ git commit --amend\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>\n\nThis is obviously the easier way.  (Or a rebase --interactive)  I've\njust got filter-branch on the brain, because of a git conversion.\n"},{"id":"109394","messageId":"49CA799A.6020807@obry.net","threadId":"18541","inReplyTo":"7v1vsl4fxo.fsf@gitster.siamese.dyndns.org","subject":"Re: reverting initial commit","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2009-03-25T18:36:10Z","receivedAt":"2009-03-25T18:36:10Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Junio C Hamano a écrit :\n> That's not even an revert.  \n\nRight.\n\n> Can't you simply amend it away?\n> \n> \t$ git rm not-this-file\n>         $ git commit --amend\n\nRight, I've done that. But the fact that un-committing the initial\ncommit was not possible seemed strange to me. At least the error message\nshould be clearer, don't you think?\n\nThanks.\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|    http://www.obry.net  -  http://v2p.fr.eu.org\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n"},{"id":"109396","messageId":"7vbprp30p2.fsf@gitster.siamese.dyndns.org","threadId":"18541","inReplyTo":"49CA799A.6020807@obry.net","subject":"Re: reverting initial commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-25T18:40:57Z","receivedAt":"2009-03-25T18:40:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> Junio C Hamano a écrit :\n>> That's not even an revert.  \n>\n> Right.\n>\n>> Can't you simply amend it away?\n>> \n>> \t$ git rm not-this-file\n>>         $ git commit --amend\n>\n> Right, I've done that. But the fact that un-committing the initial\n> commit was not possible seemed strange to me. At least the error message\n> should be clearer, don't you think?\n\n\"You said HEAD^ but there is no such thing?  What are you talking about?\"\n\nThat sounds clear enough to me, but if you have a patch to improve it,\nplease send it in.\n"},{"id":"109406","messageId":"gqe1kf$pg1$1@ger.gmane.org","threadId":"18541","inReplyTo":"8c9a060903251133x33749041oc2a5152097da0ae8@mail.gmail.com","subject":"Re: reverting initial commit","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-03-25T19:45:19Z","receivedAt":"2009-03-25T19:45:19Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Wednesday 25 March 2009 19:33, Jacob Helwig wrote:\n> On Wed, Mar 25, 2009 at 11:26, Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> That's not even an revert.  Can't you simply amend it away?\n>>\n>>        $ git rm not-this-file\n>>        $ git commit --amend\n> \n> This is obviously the easier way.  (Or a rebase --interactive)\n\nActually, rebase --interactive cannot be used to amend the first commit.\nThis is something that has hit me a couple of times when I realised, after\nthe second or third commit, that I needed to fix the first one. I found\nthe fastest way in this case to be to just format-patch all but the first\ncommit, reset --hard to the first commit, amend, and git am what I format-\npatched.\n\nI wish there was a way to tell rebase -i to go back to the first commit,\ninclusive, but the two or three times I've tried hacking at it I never\nmanaged to come to anything useful 8-/\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"109413","messageId":"fabb9a1e0903251340x637a21dav6e304aa6d2825958@mail.gmail.com","threadId":"18541","inReplyTo":"gqe1kf$pg1$1@ger.gmane.org","subject":"Re: reverting initial commit","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-03-25T20:40:46Z","receivedAt":"2009-03-25T20:40:46Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Wed, Mar 25, 2009 at 20:45, Giuseppe Bilotta\n<giuseppe.bilotta@gmail.com> wrote:\n> I wish there was a way to tell rebase -i to go back to the first commit,\n> inclusive, but the two or three times I've tried hacking at it I never\n> managed to come to anything useful 8-/\n\nWasn't --root added to rebase -i recently?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"109415","messageId":"loom.20090325T205905-856@post.gmane.org","threadId":"18541","inReplyTo":"gqe1kf$pg1$1@ger.gmane.org","subject":"Re: reverting initial commit","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2009-03-25T21:06:40Z","receivedAt":"2009-03-25T21:06:40Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"Giuseppe Bilotta <giuseppe.bilotta <at> gmail.com> writes:\n\n> Actually, rebase --interactive cannot be used to amend the first commit.\n> This is something that has hit me a couple of times when I realised, after\n> the second or third commit, that I needed to fix the first one. I found\n> the fastest way in this case to be to just format-patch all but the first\n> commit, reset --hard to the first commit, amend, and git am what I format-\n> patched.\n> \n> I wish there was a way to tell rebase -i to go back to the first commit,\n> inclusive, but the two or three times I've tried hacking at it I never\n> managed to come to anything useful 8-/\n\nI like to be able to rebase -i back to the first commit as well,\nwhich is why I generally start off with:\n\ngit init && git commit --allow-empty -m'initial commit'\n\n- Eric\n"},{"id":"109417","messageId":"cb7bb73a0903251422u5e57065l80a6b8449c79fcfd@mail.gmail.com","threadId":"18541","inReplyTo":"fabb9a1e0903251340x637a21dav6e304aa6d2825958@mail.gmail.com","subject":"Re: reverting initial commit","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-03-25T21:22:43Z","receivedAt":"2009-03-25T21:22:43Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Wed, Mar 25, 2009 at 9:40 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Heya,\n>\n> On Wed, Mar 25, 2009 at 20:45, Giuseppe Bilotta\n> <giuseppe.bilotta@gmail.com> wrote:\n>> I wish there was a way to tell rebase -i to go back to the first commit,\n>> inclusive, but the two or three times I've tried hacking at it I never\n>> managed to come to anything useful 8-/\n>\n> Wasn't --root added to rebase -i recently?\n\n>From reading the manpage I assumed it could only be used to put the\nstuff on top of something else (the --onto requirement). Or did I miss\nsomething along the way?\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}