git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phil Hord <phil.hord@gmail.com>
To: Philippe Vaucher <philippe.vaucher@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>
Subject: Re: Proposal: create meaningful aliases for git reset's hard/soft/mixed
Date: Wed, 3 Oct 2012 12:23:42 -0400	[thread overview]
Message-ID: <CABURp0rho3KvzHRNXj9EA9C2OnbTc_dcmiBiW6JZ-VHu4g2m0Q@mail.gmail.com> (raw)
In-Reply-To: <CAGK7Mr7+_n4opf=uQARxA7iSUMFNn9GCFGD5TrhCgarwGhEySA@mail.gmail.com>

On Tue, Dec 6, 2011 at 2:34 AM, Philippe Vaucher
<philippe.vaucher@gmail.com> wrote:
>> Think about why you need to use git-reset.  Why do new users need to
>> use git-reset?  What is it they are after?
>
> Ok, so let's forget about git reset and let's focus on the features
> instead. If I got it right you suggested the features that people
> wants most often are uncommit, unadd/undelete and undo. Here's a new
> proposal (based on your input):

I flagged this for followup in my MUA, but I failed to follow-up after
the holidays. I apologize for that, and I really regret it because I
liked where this was going.  I only remembered it today when it came
up again in another thread.

> uncommit: git jump <commit> (currently "git reset --soft <commit>")
> unadd/undelete: git unstage file (currently "git reset --mixed file"
> (with "git checkout file" for deleted files)
> undo: git checkout --force --clean <commit> (currently "git reset
> --hard <commit> && git clean -fd")
>
> So, let's try out some scenarios:
>
> 1) Newbie user clones/pulls a repository from somewhere. He hacks
> around and then things go bad, and he decides to scratch away
> everything he did to make sure things are like they're supposed to be.
> He'd then type "git checkout --force --clean master". If he didn't
> introduce new files, he would simply type "git checkout --force
> master"

I like this just fine.  I think we can explicitly say that HEAD is the
implied default refspec, yes?  "git checkout --force --clean"

> 2) Newbie adds some file to the index, then realise he added one too
> many. He wants to remove it from being added. He'd then type "git
> unstage file".

I'm afraid of the word "stage" because of previous discussions about
its i18n abilities.  How about "unadd" and "unrm"?  Or maybe "git undo
add", "git undo rm" and "git undo commit".

The fact that "git undo rm $FILE" works the same as "git checkout HEAD
-- $FILE" and does not truly "undo" the delete operation may make this
a non-starter.  And I admit I have other qualms about using "undo"
even though I keep on introducing it into the discussion.  For
example, this hypothetical sequence will do what I expect when I read
it:

   cp bar foo
   git add foo
   echo "more info" >> foo
   git add foo
   git unstage foo   # now index:foo == HEAD:foo

But if I use "git undo add", it will not

   cp bar foo
   git add foo
   echo "more info" >> foo
   git add foo
   git undo add foo   # index:foo == HEAD:foo, not index:foo == bar

Dang.

Well, I personally am ok with 'unstage' but I expect others will not be.

> 3) Average user creates a commit and suddenly realise he actually
> wanted to split that commit in two (he cannot use --amend, and he's
> not a rebase -i guru yet). Or he did a "temp" commit because he don't
> know about "git stash" yet and wants to discard it. He wants to simply
> go back to the previous state while keeping his changes in the index
> and the worktree. He'd then type "git jump HEAD^1".

I fear the HEAD^1 concept is too much for the newbie.  What about "git
uncommit [$REF]" instead?  It would work like "git reset --soft
$REF^", I think, but maybe it should fail if $REF has multiple
parents.

If the user really wants to uncommit a merge commit, she may need to
use "git unmerge".

Phil

  reply	other threads:[~2012-10-03 16:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23  8:28 Proposal: create meaningful aliases for git reset's hard/soft/mixed Philippe Vaucher
2011-11-23  8:49 ` Matthieu Moy
2011-11-23 11:32   ` Philippe Vaucher
2012-12-18  6:24   ` Martin von Zweigbergk
2011-11-23 12:02 ` Nguyen Thai Ngoc Duy
2011-11-23 18:51 ` Junio C Hamano
2011-11-23 23:00   ` Philippe Vaucher
2011-12-01 21:23     ` Phil Hord
2011-12-02  7:26       ` Thomas Rast
2011-12-02  7:45         ` Miles Bader
2011-12-02 15:28         ` Phil Hord
2011-12-02 14:27       ` Philippe Vaucher
2011-12-02 15:38         ` Phil Hord
2011-12-06  7:34           ` Philippe Vaucher
2012-10-03 16:23             ` Phil Hord [this message]
2012-10-03 18:41               ` Junio C Hamano
2012-10-03 19:03                 ` Junio C Hamano
2012-12-15 18:57                   ` Jan Engelhardt
2011-12-01 21:02   ` Phil Hord
2012-12-18  6:34   ` Martin von Zweigbergk
2012-12-18 15:22     ` Junio C Hamano
2012-12-18 16:30     ` Jeff King

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=CABURp0rho3KvzHRNXj9EA9C2OnbTc_dcmiBiW6JZ-VHu4g2m0Q@mail.gmail.com \
    --to=phil.hord@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=philippe.vaucher@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.
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).