git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: "Pierre-François CLEMENT" <likeyn@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Git reset --hard with staged changes
Date: Mon, 09 Jun 2014 16:04:43 +0200	[thread overview]
Message-ID: <87vbsayy9w.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <CANWD=rX-MEiS4cNzDWr2wwkshz2zu8-L31UrKwbZrJSBcJX-nQ@mail.gmail.com> ("Pierre-François CLEMENT"'s message of "Mon, 9 Jun 2014 13:24:56 +0200")

Pierre-François CLEMENT <likeyn@gmail.com> writes:

> Hi all,
>
> Someone pointed out on the "Git for human beings" Google group
> (https://groups.google.com/d/topic/git-users/27_FxIV_100/discussion)
> that using git-reset's hard mode when having staged untracked files
> simply deletes them from the working dir.
>
> Since git-reset specifically doesn't touch untracked files, one could
> expect having staged untracked files reset to their previous
> "untracked" state rather than being deleted.
>
> Could this be a bug or a missing feature? Or if it isn't, can someone
> explain what we got wrong?

git reset --keep maybe?

In a work dir and index without modifications, I expect

git apply --index ...
git reset --hard

to remove any files that git apply created.  It would not do so using
your proposal.  I agree that it seems a bit of a borderline, but I
consider it better that once a file _is_ tracked, git reset --hard will
first physically remove it before untracking it.

-- 
David Kastrup

  reply	other threads:[~2014-06-09 14:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANWD=rWmzgAwTp=E_1=th0Myk-dh4m5Y9PE3=fpHeirsVVQKwQ@mail.gmail.com>
2014-06-09 11:24 ` Git reset --hard with staged changes Pierre-François CLEMENT
2014-06-09 14:04   ` David Kastrup [this message]
2014-06-09 23:22     ` Pierre-François CLEMENT
2014-06-09 23:28       ` Junio C Hamano
2014-06-10 14:59         ` Pierre-François CLEMENT
2014-06-10 15:27           ` David Kastrup
2014-06-10 16:30             ` Pierre-François CLEMENT
2014-06-10  1:03       ` Dale Worley
2014-06-10  5:44         ` Junio C Hamano
2016-05-23  0:55 Yotam Gingold
2016-05-23 17:05 ` Junio C Hamano
2016-05-23 19:31 ` Christian Couder
2016-05-23 21:16   ` Junio C Hamano
2016-05-24  6:20     ` Christian Couder
2016-05-30  5:07       ` Yotam Gingold
2016-05-31  6:02         ` Junio C Hamano
2016-05-31  6:41           ` Christian Couder

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=87vbsayy9w.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=likeyn@gmail.com \
    /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 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).