git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Proposal: "unadd" command / alias.

From
Filipp Bakanov <filipp@bakanov.su>
Date
Oct 28, 2020, 13:56 UTC
Message-ID
<CAAdniQ7TGuv0uFjwPOYfzo7zS0v-tEJ9kSWwB86Hjg0XstOE7A@mail.gmail.com>
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:
Show 41 quoted lines
>
> 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
Previous: Pratyush YadavNext: Junio C Hamano
Message 9 of 12 in “Proposal: "unadd" command / alias.”
  1. Filipp BakanovOct 27, 2020
  2. Junio C HamanoOct 27, 2020
  3. Theodore Y. Ts'oOct 27, 2020
  4. Filipp BakanovOct 27, 2020
  5. Theodore Y. Ts'oOct 27, 2020
  6. Filipp BakanovOct 27, 2020
  7. Philip OakleyOct 28, 2020
  8. Pratyush YadavOct 28, 2020
  9. Filipp BakanovOct 28, 2020
  10. Junio C HamanoOct 28, 2020
  11. Konstantin TokarevOct 28, 2020
  12. Filipp BakanovOct 28, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.