git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Stephan Beyer <s-beyer@gmx.net>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Jakub Narebski <jnareb@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Paolo Bonzini <bonzini@gnu.org>
Subject: Re: [PATCH v2 3/4] reset: add option "--merge-safe" to "git reset"
Date: Wed, 16 Sep 2009 22:23:12 -0700	[thread overview]
Message-ID: <7veiq6kuv3.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <200909170554.49416.chriscool@tuxfamily.org> (Christian Couder's message of "Thu\, 17 Sep 2009 05\:54\:48 +0200")

Christian Couder <chriscool@tuxfamily.org> writes:

> But I think that it can be usefull in case like:
>
> $ "hack something"
> $ git commit ...
> $ "hack something else"
> $ git add "some of the files"
> $ "find out previous commit was crap"
> $ git reset --merge-safe HEAD^
>
> Here using "--merge-safe" can be usefull because you don't want to lose 
> stuff in your current index and work tree.

That depends on the reason why you are resetting away the "crap commit"
and what your next move is.

If you are going to run "git commit", perhaps after some further edit, in
order to fix what the "crap commit" did not quite do right, what your new
option does is actively a wrong thing to do.  "Some of the files" you
added after that "crap commit" are about "hack something else", i.e. not
part of the work to fix the "crap commit", and their changes should not be
included in the amended commit, no?

In general, "reset" should be about matching the index entries to the
named commit, so that you can start from the clean, known slate to redo
the commit you wanted to make on top of it.  You would need a very good
use case to deviate from it and leave the index entry different from that
of the commit you are switching to; otherwise you would greatly confuse
the end users.

  reply	other threads:[~2009-09-17  5:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16  4:14 [PATCH v2 0/4] "git reset --merge" related improvements Christian Couder
2009-09-16  4:14 ` [PATCH v2 1/4] reset: add a few tests for "git reset --merge" Christian Couder
2009-09-16  4:14 ` [PATCH v2 2/4] reset: use "unpack_trees()" directly instead of "git read-tree" Christian Couder
2009-09-16  4:14 ` [PATCH v2 3/4] reset: add option "--merge-safe" to "git reset" Christian Couder
2009-09-16 18:37   ` Junio C Hamano
2009-09-17  3:54     ` Christian Couder
2009-09-17  5:23       ` Junio C Hamano [this message]
2009-09-16  4:14 ` [PATCH v2 4/4] reset: add test cases for "--merge-safe" option 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7veiq6kuv3.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=bonzini@gnu.org \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=s-beyer@gmx.net \
    --cc=torvalds@linux-foundation.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).