All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Bahadir Balban <bahadir.balban@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: reverting back both working copy and commits
Date: Wed, 11 Jan 2006 11:37:26 -0800	[thread overview]
Message-ID: <7vslrutv2h.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7ac1e90c0601110832u6fc3a3bcwb7e584445610e53f@mail.gmail.com> (Bahadir Balban's message of "Wed, 11 Jan 2006 16:32:16 +0000")

Bahadir Balban <bahadir.balban@gmail.com> writes:

> % git-branch master-2006-get-rid-of-commits
>
> % git-reset --hard [sha1id]
>
> where sha1id is the id of commit I want to revert back to. After this,
> git-log points at the right commit (the one with [sha1id]) as the last
> commit made. However, the working copy is left in the original state,
> i.e with the unwanted changes.

Eh?  That should not happen.

Could you elaborate?

	$ git diff master-2006-get-rid-of-commits

should show differences between the wrongly committed state and
your working tree.

	$ git diff --cached HEAD ;# or git diff --cached [sha1id]

should show *nothing* and

	$ git diff HEAD ;# or git diff [sha1id]

should also show nothing.

What is different between what I just described "Thess should
happen" and what actually happens to you?  I use "git reset
--hard" all the time, probably a lot more often than other
people, and I'd be surprised if things are not working.

What "git reset --hard" would leave behind are files in the
working tree that you had when you made the wrongly done commit,
which were *not* known to git (i.e. you forgot to "git add"
before committing).  Since they are not known to git, "reset --hard"
does not touch them.

  parent reply	other threads:[~2006-01-11 19:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-11 16:32 reverting back both working copy and commits Bahadir Balban
2006-01-11 19:28 ` Andreas Ericsson
2006-01-11 19:37 ` Junio C Hamano [this message]
2006-01-12 10:40   ` Bahadir Balban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vslrutv2h.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=bahadir.balban@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.