git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git reset --hard include/linux/config.h
@ 2006-07-05 16:58 Sam Ravnborg
  2006-07-05 17:05 ` Alex Riesen
  2006-07-06  2:45 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Sam Ravnborg @ 2006-07-05 16:58 UTC (permalink / raw)
  To: git

While working on something unrelated I just did a quick hack
in include/linux/config.h
When done I wanted to get rid of the changes so I did:
git reset --hard include/linux/config.h

And the changes made to include/linux/config.h was indeed gone, with
all the other changes I had in other files.

Now git reset is maybe supposed to work on commit level only, but it
would have been nice if it erroroed out when it saw an argument that
it did not know about. In this case I assume git reset used
"include/linux/config.h" as <commitish>.

Also what is the right command to bring back a file to the original
state after doing some modifications that was not needed anyway?

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git reset --hard include/linux/config.h
  2006-07-05 16:58 git reset --hard include/linux/config.h Sam Ravnborg
@ 2006-07-05 17:05 ` Alex Riesen
  2006-07-05 17:14   ` Sam Ravnborg
  2006-07-06  2:45 ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Alex Riesen @ 2006-07-05 17:05 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: git

On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:
> Also what is the right command to bring back a file to the original
> state after doing some modifications that was not needed anyway?

git checkout HEAD include/linux/config.h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git reset --hard include/linux/config.h
  2006-07-05 17:05 ` Alex Riesen
@ 2006-07-05 17:14   ` Sam Ravnborg
  2006-07-05 17:29     ` Alex Riesen
  0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2006-07-05 17:14 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

On Wed, Jul 05, 2006 at 07:05:27PM +0200, Alex Riesen wrote:
> On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:
> >Also what is the right command to bring back a file to the original
> >state after doing some modifications that was not needed anyway?
> 
> git checkout HEAD include/linux/config.h

Thanks!

By the way - the modifications to include/linux/config.h was not lost.
But git apperantly managed to be fooled to think the file was
up-to-date.

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git reset --hard include/linux/config.h
  2006-07-05 17:14   ` Sam Ravnborg
@ 2006-07-05 17:29     ` Alex Riesen
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Riesen @ 2006-07-05 17:29 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: git

On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Wed, Jul 05, 2006 at 07:05:27PM +0200, Alex Riesen wrote:
> > On 7/5/06, Sam Ravnborg <sam@ravnborg.org> wrote:
> > >Also what is the right command to bring back a file to the original
> > >state after doing some modifications that was not needed anyway?
> >
> > git checkout HEAD include/linux/config.h
>
> Thanks!
>
> By the way - the modifications to include/linux/config.h was not lost.
> But git apperantly managed to be fooled to think the file was
> up-to-date.

After that checkout or after reset --hard? Both is quiet unusual, though

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git reset --hard include/linux/config.h
  2006-07-05 16:58 git reset --hard include/linux/config.h Sam Ravnborg
  2006-07-05 17:05 ` Alex Riesen
@ 2006-07-06  2:45 ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2006-07-06  2:45 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: git

Sam Ravnborg <sam@ravnborg.org> writes:

> Now git reset is maybe supposed to work on commit level only, but it
> would have been nice if it erroroed out when it saw an argument that
> it did not know about. In this case I assume git reset used
> "include/linux/config.h" as <commitish>.

There is an attempt to have that check, but obviously it is
busted.  Thanks for noticing.

Maybe something like this is needed instead.

-- >8 --
git-reset: complain and exit upon seeing an unknown parameter.

The check to use "rev-parse --verify" was defeated by the use of
"--default HEAD".  "git reset --hard bogus-committish" just
defaulted to reset to the HEAD without complaining.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-reset.sh b/git-reset.sh
index 46451d0..5c02240 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -17,7 +17,11 @@ case "$1" in
         usage ;;
 esac
 
-rev=$(git-rev-parse --verify --default HEAD "$@") || exit
+case $# in
+0) rev=HEAD ;;
+1) rev=$(git-rev-parse --verify "$1") || exit ;;
+*) usage ;;
+esac
 rev=$(git-rev-parse --verify $rev^0) || exit
 
 # We need to remember the set of paths that _could_ be left

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-06  2:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-05 16:58 git reset --hard include/linux/config.h Sam Ravnborg
2006-07-05 17:05 ` Alex Riesen
2006-07-05 17:14   ` Sam Ravnborg
2006-07-05 17:29     ` Alex Riesen
2006-07-06  2:45 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).