{"thread":{"id":"4776","subject":"git reset --hard include/linux/config.h","startedAt":"2006-07-05T16:58:01Z","lastAt":"2006-07-06T02:45:59Z","messageCount":5,"participants":["Sam Ravnborg","Alex Riesen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"23284","messageId":"20060705165801.GA11822@mars.ravnborg.org","threadId":"4776","inReplyTo":null,"subject":"git reset --hard include/linux/config.h","fromName":"Sam Ravnborg","fromEmail":"sam@ravnborg.org","sentAt":"2006-07-05T16:58:01Z","receivedAt":"2006-07-05T16:58:01Z","isPatch":false,"sender":{"key":"sam@ravnborg.org","avatar":"https://gravatar.com/avatar/168a912606ed0742d840bb365e3cc21db390c36531a58341dc7a069cc1f15f62?d=mp&s=160"},"body":"While working on something unrelated I just did a quick hack\nin include/linux/config.h\nWhen done I wanted to get rid of the changes so I did:\ngit reset --hard include/linux/config.h\n\nAnd the changes made to include/linux/config.h was indeed gone, with\nall the other changes I had in other files.\n\nNow git reset is maybe supposed to work on commit level only, but it\nwould have been nice if it erroroed out when it saw an argument that\nit did not know about. In this case I assume git reset used\n\"include/linux/config.h\" as <commitish>.\n\nAlso what is the right command to bring back a file to the original\nstate after doing some modifications that was not needed anyway?\n\n\tSam\n"},{"id":"23286","messageId":"81b0412b0607051005s59315296tfb68345959a14c1b@mail.gmail.com","threadId":"4776","inReplyTo":"20060705165801.GA11822@mars.ravnborg.org","subject":"Re: git reset --hard include/linux/config.h","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-07-05T17:05:27Z","receivedAt":"2006-07-05T17:05:27Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:\n> Also what is the right command to bring back a file to the original\n> state after doing some modifications that was not needed anyway?\n\ngit checkout HEAD include/linux/config.h\n"},{"id":"23287","messageId":"20060705171406.GA17834@mars.ravnborg.org","threadId":"4776","inReplyTo":"81b0412b0607051005s59315296tfb68345959a14c1b@mail.gmail.com","subject":"Re: git reset --hard include/linux/config.h","fromName":"Sam Ravnborg","fromEmail":"sam@ravnborg.org","sentAt":"2006-07-05T17:14:06Z","receivedAt":"2006-07-05T17:14:06Z","isPatch":false,"sender":{"key":"sam@ravnborg.org","avatar":"https://gravatar.com/avatar/168a912606ed0742d840bb365e3cc21db390c36531a58341dc7a069cc1f15f62?d=mp&s=160"},"body":"On Wed, Jul 05, 2006 at 07:05:27PM +0200, Alex Riesen wrote:\n> On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:\n> >Also what is the right command to bring back a file to the original\n> >state after doing some modifications that was not needed anyway?\n> \n> git checkout HEAD include/linux/config.h\n\nThanks!\n\nBy the way - the modifications to include/linux/config.h was not lost.\nBut git apperantly managed to be fooled to think the file was\nup-to-date.\n\n\tSam\n"},{"id":"23288","messageId":"81b0412b0607051029q175928faq113b81de8c11db30@mail.gmail.com","threadId":"4776","inReplyTo":"20060705171406.GA17834@mars.ravnborg.org","subject":"Re: git reset --hard include/linux/config.h","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-07-05T17:29:07Z","receivedAt":"2006-07-05T17:29:07Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:\n> On Wed, Jul 05, 2006 at 07:05:27PM +0200, Alex Riesen wrote:\n> > On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:\n> > >Also what is the right command to bring back a file to the original\n> > >state after doing some modifications that was not needed anyway?\n> >\n> > git checkout HEAD include/linux/config.h\n>\n> Thanks!\n>\n> By the way - the modifications to include/linux/config.h was not lost.\n> But git apperantly managed to be fooled to think the file was\n> up-to-date.\n\nAfter that checkout or after reset --hard? Both is quiet unusual, though\n"},{"id":"23298","messageId":"7vhd1va1so.fsf@assigned-by-dhcp.cox.net","threadId":"4776","inReplyTo":"20060705165801.GA11822@mars.ravnborg.org","subject":"Re: git reset --hard include/linux/config.h","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-06T02:45:59Z","receivedAt":"2006-07-06T02:45:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Ravnborg <sam@ravnborg.org> writes:\n\n> Now git reset is maybe supposed to work on commit level only, but it\n> would have been nice if it erroroed out when it saw an argument that\n> it did not know about. In this case I assume git reset used\n> \"include/linux/config.h\" as <commitish>.\n\nThere is an attempt to have that check, but obviously it is\nbusted.  Thanks for noticing.\n\nMaybe something like this is needed instead.\n\n-- >8 --\ngit-reset: complain and exit upon seeing an unknown parameter.\n\nThe check to use \"rev-parse --verify\" was defeated by the use of\n\"--default HEAD\".  \"git reset --hard bogus-committish\" just\ndefaulted to reset to the HEAD without complaining.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ndiff --git a/git-reset.sh b/git-reset.sh\nindex 46451d0..5c02240 100755\n--- a/git-reset.sh\n+++ b/git-reset.sh\n@@ -17,7 +17,11 @@ case \"$1\" in\n         usage ;;\n esac\n \n-rev=$(git-rev-parse --verify --default HEAD \"$@\") || exit\n+case $# in\n+0) rev=HEAD ;;\n+1) rev=$(git-rev-parse --verify \"$1\") || exit ;;\n+*) usage ;;\n+esac\n rev=$(git-rev-parse --verify $rev^0) || exit\n \n # We need to remember the set of paths that _could_ be left\n"}]}