git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git reset --hard <commit> superfluous?
@ 2009-01-03  1:13 chris
  2009-01-03  6:34 ` Sitaram Chamarty
  2009-01-03 12:20 ` Björn Steinbrink
  0 siblings, 2 replies; 3+ messages in thread
From: chris @ 2009-01-03  1:13 UTC (permalink / raw)
  To: git

David

git reset --hard <commit>
"resets" the current branch head.

Is this equivalent to deleting the branch
and doing

git branch <branch> <commit> ??

So "git reset --hard" is syntactic sugar and 'unnecessary' right?

cs

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

* Re: git reset --hard <commit> superfluous?
  2009-01-03  1:13 git reset --hard <commit> superfluous? chris
@ 2009-01-03  6:34 ` Sitaram Chamarty
  2009-01-03 12:20 ` Björn Steinbrink
  1 sibling, 0 replies; 3+ messages in thread
From: Sitaram Chamarty @ 2009-01-03  6:34 UTC (permalink / raw)
  To: git

On 2009-01-03, chris@seberino.org <chris@seberino.org> wrote:
> git reset --hard <commit>
> "resets" the current branch head.
>
> Is this equivalent to deleting the branch
> and doing
>
> git branch <branch> <commit> ??
>
> So "git reset --hard" is syntactic sugar and 'unnecessary' right?

only if you don't have any local changes to the work tree or
the index :-)

If you do, however, the reset throws them away, while the
longer method tries to preserves them, to the point of not
letting you switch if there are too many changes.

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

* Re: git reset --hard <commit> superfluous?
  2009-01-03  1:13 git reset --hard <commit> superfluous? chris
  2009-01-03  6:34 ` Sitaram Chamarty
@ 2009-01-03 12:20 ` Björn Steinbrink
  1 sibling, 0 replies; 3+ messages in thread
From: Björn Steinbrink @ 2009-01-03 12:20 UTC (permalink / raw)
  To: chris; +Cc: git

On 2009.01.02 17:13:19 -0800, chris@seberino.org wrote:
> David
> 
> git reset --hard <commit>
> "resets" the current branch head.
> 
> Is this equivalent to deleting the branch
> and doing
> 
> git branch <branch> <commit> ??
> 
> So "git reset --hard" is syntactic sugar and 'unnecessary' right?

Deleting the branch also deletes the reflog, while using reset adds a
new entry to the reflog. So returning the branch head to its previous
state is pretty trivial if you used reset and might be pretty hard if
you deleted the branch. HEAD's reflog should probably have the right
entry as well, but chances are that it's hidden in a crapload of other
entries, especially if you rebase often.

Björn

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

end of thread, other threads:[~2009-01-03 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-03  1:13 git reset --hard <commit> superfluous? chris
2009-01-03  6:34 ` Sitaram Chamarty
2009-01-03 12:20 ` Björn Steinbrink

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).