From: Filipp Bakanov <filipp@bakanov.su>
To: Pratyush Yadav <me@yadavpratyush.com>
Cc: git@vger.kernel.org
Subject: Re: Proposal: "unadd" command / alias.
Date: Wed, 28 Oct 2020 16:56:50 +0300 [thread overview]
Message-ID: <CAAdniQ7TGuv0uFjwPOYfzo7zS0v-tEJ9kSWwB86Hjg0XstOE7A@mail.gmail.com> (raw)
In-Reply-To: <87eelifqii.fsf@yadavpratyush.com>
Thank you for mentioning git restore.
Answering to your question, my brain filtered all the output of git
status except "modified: ..."
There are multiple reasons:
- command named restore. I don't know what it will restore. Maybe it
will restore a clean version? Maybe it will remove all my changes? I
don't want to risk.
- I don't know what means "unstage". I didn't run "git stage" to add
my files, why should I run git restore --staged to undo git add? If
command would be named "git unadd" and description would be "undo git
add", it would be more obvious than git restore --staged or git reset.
I asked my friends, no one remembered how to undo git add. One said:
" - May be it's git reset but I'm not sure, need to check before
apply". And he agreed that "git unadd" would be a more obvious.
On Wed, 28 Oct 2020 at 16:07, Pratyush Yadav <me@yadavpratyush.com> wrote:
>
> On Tue, Oct 27 2020, Filipp Bakanov wrote:
>
> > Hi! I suggest to add "unadd" command, that will undo a git add command.
> >
> > git unadd path/to/file
> >
> > It will be an alias to:
> >
> > git reset HEAD -- path/to/file
> >
> > The motivation is that I always forget syntax and have to google each
> > time I want to undo accidentally added files. Unadd is just much
> > easier to remember and quite obvious.
>
> Why do you need to Google when `git status` tells you how to do it?
>
> $ touch foo
> $ git add foo
> $ git status
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Changes to be committed:
> (use "git restore --staged <file>..." to unstage)
> new file: foo
>
> $ git restore --staged foo
> $ git status
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Untracked files:
> (use "git add <file>..." to include in what will be committed)
> foo
>
> nothing added to commit but untracked files present (use "git add" to track)
>
> --
> Regards,
> Pratyush Yadav
next prev parent reply other threads:[~2020-10-28 22:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 20:10 Proposal: "unadd" command / alias Filipp Bakanov
2020-10-27 20:32 ` Junio C Hamano
2020-10-27 21:56 ` Theodore Y. Ts'o
2020-10-27 22:02 ` Filipp Bakanov
2020-10-27 22:54 ` Theodore Y. Ts'o
2020-10-27 23:14 ` Filipp Bakanov
2020-10-28 11:00 ` Philip Oakley
2020-10-28 12:13 ` Konstantin Tokarev
2020-10-28 12:21 ` Filipp Bakanov
2020-10-28 13:07 ` Pratyush Yadav
2020-10-28 13:56 ` Filipp Bakanov [this message]
2020-10-28 23:44 ` Junio C Hamano
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=CAAdniQ7TGuv0uFjwPOYfzo7zS0v-tEJ9kSWwB86Hjg0XstOE7A@mail.gmail.com \
--to=filipp@bakanov.su \
--cc=git@vger.kernel.org \
--cc=me@yadavpratyush.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).