git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <bebarino@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, srabbelier@gmail.com,
	Thomas Rast <trast@student.ethz.ch>,
	Jakub Narebski <jnareb@gmail.com>,
	Christian Couder <chriscool@tuxfamily.org>,
	Johan Herland <johan@herland.net>
Subject: Re: [RFC/PATCH 1/2] Documentation: suggest "reset --merge" more often
Date: Wed, 03 Nov 2010 02:32:12 -0700	[thread overview]
Message-ID: <4CD12C1C.2020507@gmail.com> (raw)
In-Reply-To: <20101029083836.GB26290@burratino>

On 10/29/10 01:38, Jonathan Nieder wrote:
> With its new semantics, "git reset --merge" is more suitable for
> undoing a failed merge than "git reset --hard" is.  It is especially
> nice if you forget that you are in a merge and make a change or two:
> 
>   git merge something-complicated
>   ... notice conflicts, walk away ...
>   vi foo.c
>   git commit; # fails because the index has unmerged entries
>   git reset --merge
> 
> The modern (post-1.7.0) semantics of git reset --merge ensure that
> the changes to foo.c will be preserved by this sequence of commands,
> unless foo.c was one of the files with conflicts.
> 
> So in the spirit of ed4a6baa (Documentation: suggest `reset --merge`
> in How Merge Works section, 2010-01-23), recommend it in place of
> "reset --hard".
> 
> One caveat: for habitual adders-to-index, "git reset --merge" is
> no better than "git reset --hard" (though still no worse).
> 
>   vi foo.c
>   git add -u
>   git diff --cached --check; # fails because conflict markers are present
>   git reset --merge; # equivalent to git reset --hard
> 

Would it also be a good idea to fill in the hint in git status for the
in_merge case with similar information?

  reply	other threads:[~2010-11-03  9:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29  8:35 [RFC/PATCH 0/2] Documentation: kicking the "reset --hard" habit Jonathan Nieder
2010-10-29  8:38 ` [RFC/PATCH 1/2] Documentation: suggest "reset --merge" more often Jonathan Nieder
2010-11-03  9:32   ` Stephen Boyd [this message]
2010-10-29  8:39 ` [RFC/PATCH 2/2] Documentation: suggest "reset --keep" " Jonathan Nieder
2010-10-30  1:55 ` [RFC/PATCH 0/2] Documentation: kicking the "reset --hard" habit Matthieu Moy
2010-10-31  3:53   ` Junio C Hamano
2010-10-31 14:04     ` Matthieu Moy
2010-11-05 14:39       ` Oldest Currently Distributed Git {Re: [RFC/PATCH 0/2] Documentation: kicking the "reset --hard" habit} Drew Northup
2010-10-31 17:25   ` [RFC/PATCH 0/2] Documentation: kicking the "reset --hard" habit Ævar Arnfjörð Bjarmason
2010-11-01 20:03     ` J. Bruce Fields

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=4CD12C1C.2020507@gmail.com \
    --to=bebarino@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=johan@herland.net \
    --cc=jrnieder@gmail.com \
    --cc=srabbelier@gmail.com \
    --cc=trast@student.ethz.ch \
    /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).