All of lore.kernel.org
 help / color / mirror / Atom feed
* Proposal: "unadd" command / alias.
@ 2020-10-27 20:10 Filipp Bakanov
  2020-10-27 20:32 ` Junio C Hamano
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Filipp Bakanov @ 2020-10-27 20:10 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  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-28 12:13 ` Konstantin Tokarev
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2020-10-27 20:32 UTC (permalink / raw)
  To: Filipp Bakanov; +Cc: git

Filipp Bakanov <filipp@bakanov.su> writes:

> 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.

The alias is for you to do the above, I think.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 20:32 ` Junio C Hamano
@ 2020-10-27 21:56   ` Theodore Y. Ts'o
  2020-10-27 22:02     ` Filipp Bakanov
  0 siblings, 1 reply; 12+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-27 21:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Filipp Bakanov, git

On Tue, Oct 27, 2020 at 01:32:50PM -0700, Junio C Hamano wrote:
> Filipp Bakanov <filipp@bakanov.su> writes:
> 
> > 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.
> 
> The alias is for you to do the above, I think.

Filipp,

Indeed, I have a similar alias in my ~/.gitconfig

[alias]
	revert-file = checkout HEAD --

Adding

[alias]
	unadd = reset HEAD --

to your .gitconfig would do what you want.  As a BTW, my favorite
alias is:

   lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit

Sample usage: "git lgt origin.." or "git lgt -10".

Cheers,

					- Ted

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  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
  0 siblings, 1 reply; 12+ messages in thread
From: Filipp Bakanov @ 2020-10-27 22:02 UTC (permalink / raw)
  To: Theodore Y. Ts'o; +Cc: Junio C Hamano, git

>> Indeed, I have a similar alias in my ~/.gitconfig

Why not just add it to git by default for everybody? revert-file is
also ok, anything except `checkout HEAD --` will be good.

On Wed, 28 Oct 2020 at 00:56, Theodore Y. Ts'o <tytso@mit.edu> wrote:
>
> On Tue, Oct 27, 2020 at 01:32:50PM -0700, Junio C Hamano wrote:
> > Filipp Bakanov <filipp@bakanov.su> writes:
> >
> > > 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.
> >
> > The alias is for you to do the above, I think.
>
> Filipp,
>
> Indeed, I have a similar alias in my ~/.gitconfig
>
> [alias]
>         revert-file = checkout HEAD --
>
> Adding
>
> [alias]
>         unadd = reset HEAD --
>
> to your .gitconfig would do what you want.  As a BTW, my favorite
> alias is:
>
>    lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>
> Sample usage: "git lgt origin.." or "git lgt -10".
>
> Cheers,
>
>                                         - Ted

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 22:02     ` Filipp Bakanov
@ 2020-10-27 22:54       ` Theodore Y. Ts'o
  2020-10-27 23:14         ` Filipp Bakanov
  0 siblings, 1 reply; 12+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-27 22:54 UTC (permalink / raw)
  To: Filipp Bakanov; +Cc: Junio C Hamano, git

On Wed, Oct 28, 2020 at 01:02:11AM +0300, Filipp Bakanov wrote:
> >> Indeed, I have a similar alias in my ~/.gitconfig
> 
> Why not just add it to git by default for everybody? revert-file is
> also ok, anything except `checkout HEAD --` will be good.

Because everyone may have their own favorite aliases?  Just because
*I* have the following aliases doesn't mean that everyone else would
find them useful.

[alias]
	new = !gitk --all --not ORIG_HEAD
	dw = diff --stat --summary
	di = diff --stat --summary --cached
	dc = describe --contains
	revert-file = checkout HEAD --
	l  = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
	lr = log --reverse --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
	rl  = log -g --pretty=format:'%Cred%h%Creset %gd %gs %Cgreen(%gr)%Creset %s' --abbrev-commit
	rl1  = log -g --date=relative --pretty=format:'%Cred%h%Creset %gs %Cgreen%gd%Creset %s' --abbrev-commit
	lg  = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
	lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
	rlt = log -g --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
	lgt-nc = log --graph --pretty=format:'%h -%d %s (%cr)' --abbrev-commit
	st = status -s
	recent = for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'
	gerrit-clone = !bash ggh gerrit-clone
	start = !bash ggh start
	upload = !bash ggh upload
	prune-branches = !bash ggh prune-branches
	fixes = log -1 --pretty=fixes

I have a huge number of bash aliases, and that doesn't mean everyone
else should have those bash aliases.  For that matter, I have the
following in ~/bin/git-rp-ext4 so that I can type "git rp-ext4
tags/ext4_for_linus".  But that doesn't mean this script is right for
everyone....

Cheers,

					- Ted

#!/bin/sh

START=origin
URL=git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
END=""

print_help ()
{
    PROG=$(basename "$0")
    echo "Usage: $PROG [-n] [--start <START COMMIT>] [--url <URL] [<END COMMIT>]"
    exit 1
}

while [ "$1" != "" ]; do
    case $1 in
	--start) shift
		 START="$1"
		 ;;
	--url) shift
	       URL="$1"
	       ;;
	-n) NO_ACTION="echo" ;;
	-*) print_help ;;
	*)
	    if test -n "$END"
	    then
		print_help
	    else
		END="$1"
	    fi
	    ;;
    esac
    shift
done

$NO_ACTION git request-pull "$START" "$URL" "$END"


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 22:54       ` Theodore Y. Ts'o
@ 2020-10-27 23:14         ` Filipp Bakanov
  2020-10-28 11:00           ` Philip Oakley
  0 siblings, 1 reply; 12+ messages in thread
From: Filipp Bakanov @ 2020-10-27 23:14 UTC (permalink / raw)
  To: Theodore Y. Ts'o; +Cc: Junio C Hamano, git

It's the matter of UX. If many users have to make an alias for the
same unclear command, at least it's a point to think about making this
particular command more convenient. As far as I remember, some aliases
were already added to git by default.
What's bad with adding a popular (among many users) aliases, if they
improve UX and make life easier?

On Wed, 28 Oct 2020 at 01:54, Theodore Y. Ts'o <tytso@mit.edu> wrote:
>
> On Wed, Oct 28, 2020 at 01:02:11AM +0300, Filipp Bakanov wrote:
> > >> Indeed, I have a similar alias in my ~/.gitconfig
> >
> > Why not just add it to git by default for everybody? revert-file is
> > also ok, anything except `checkout HEAD --` will be good.
>
> Because everyone may have their own favorite aliases?  Just because
> *I* have the following aliases doesn't mean that everyone else would
> find them useful.
>
> [alias]
>         new = !gitk --all --not ORIG_HEAD
>         dw = diff --stat --summary
>         di = diff --stat --summary --cached
>         dc = describe --contains
>         revert-file = checkout HEAD --
>         l  = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>         lr = log --reverse --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>         rl  = log -g --pretty=format:'%Cred%h%Creset %gd %gs %Cgreen(%gr)%Creset %s' --abbrev-commit
>         rl1  = log -g --date=relative --pretty=format:'%Cred%h%Creset %gs %Cgreen%gd%Creset %s' --abbrev-commit
>         lg  = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>         lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>         rlt = log -g --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>         lgt-nc = log --graph --pretty=format:'%h -%d %s (%cr)' --abbrev-commit
>         st = status -s
>         recent = for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'
>         gerrit-clone = !bash ggh gerrit-clone
>         start = !bash ggh start
>         upload = !bash ggh upload
>         prune-branches = !bash ggh prune-branches
>         fixes = log -1 --pretty=fixes
>
> I have a huge number of bash aliases, and that doesn't mean everyone
> else should have those bash aliases.  For that matter, I have the
> following in ~/bin/git-rp-ext4 so that I can type "git rp-ext4
> tags/ext4_for_linus".  But that doesn't mean this script is right for
> everyone....
>
> Cheers,
>
>                                         - Ted
>
> #!/bin/sh
>
> START=origin
> URL=git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
> END=""
>
> print_help ()
> {
>     PROG=$(basename "$0")
>     echo "Usage: $PROG [-n] [--start <START COMMIT>] [--url <URL] [<END COMMIT>]"
>     exit 1
> }
>
> while [ "$1" != "" ]; do
>     case $1 in
>         --start) shift
>                  START="$1"
>                  ;;
>         --url) shift
>                URL="$1"
>                ;;
>         -n) NO_ACTION="echo" ;;
>         -*) print_help ;;
>         *)
>             if test -n "$END"
>             then
>                 print_help
>             else
>                 END="$1"
>             fi
>             ;;
>     esac
>     shift
> done
>
> $NO_ACTION git request-pull "$START" "$URL" "$END"
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 23:14         ` Filipp Bakanov
@ 2020-10-28 11:00           ` Philip Oakley
  0 siblings, 0 replies; 12+ messages in thread
From: Philip Oakley @ 2020-10-28 11:00 UTC (permalink / raw)
  To: Filipp Bakanov, Theodore Y. Ts'o; +Cc: Junio C Hamano, git

On 27/10/2020 23:14, Filipp Bakanov wrote:
> It's the matter of UX. If many users have to make an alias for the
> same unclear command, at least it's a point to think about making this
> particular command more convenient. As far as I remember, some aliases
> were already added to git by default.
> What's bad with adding a popular (among many users) aliases, if they
> improve UX and make life easier?

One option maybe to curate a few of the more popular aliases within a
contrib/aliases file/directory.

Not sure how best to add comments into the alias file so folks can
remember what they are really meant to do, or where they copied them from.

Philip

>
> On Wed, 28 Oct 2020 at 01:54, Theodore Y. Ts'o <tytso@mit.edu> wrote:
>> On Wed, Oct 28, 2020 at 01:02:11AM +0300, Filipp Bakanov wrote:
>>>>> Indeed, I have a similar alias in my ~/.gitconfig
>>> Why not just add it to git by default for everybody? revert-file is
>>> also ok, anything except `checkout HEAD --` will be good.
>> Because everyone may have their own favorite aliases?  Just because
>> *I* have the following aliases doesn't mean that everyone else would
>> find them useful.
>>
>> [alias]
>>         new = !gitk --all --not ORIG_HEAD
>>         dw = diff --stat --summary
>>         di = diff --stat --summary --cached
>>         dc = describe --contains
>>         revert-file = checkout HEAD --
>>         l  = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>>         lr = log --reverse --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>>         rl  = log -g --pretty=format:'%Cred%h%Creset %gd %gs %Cgreen(%gr)%Creset %s' --abbrev-commit
>>         rl1  = log -g --date=relative --pretty=format:'%Cred%h%Creset %gs %Cgreen%gd%Creset %s' --abbrev-commit
>>         lg  = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>>         lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>>         rlt = log -g --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit
>>         lgt-nc = log --graph --pretty=format:'%h -%d %s (%cr)' --abbrev-commit
>>         st = status -s
>>         recent = for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'
>>         gerrit-clone = !bash ggh gerrit-clone
>>         start = !bash ggh start
>>         upload = !bash ggh upload
>>         prune-branches = !bash ggh prune-branches
>>         fixes = log -1 --pretty=fixes
>>
>> I have a huge number of bash aliases, and that doesn't mean everyone
>> else should have those bash aliases.  For that matter, I have the
>> following in ~/bin/git-rp-ext4 so that I can type "git rp-ext4
>> tags/ext4_for_linus".  But that doesn't mean this script is right for
>> everyone....
>>
>> Cheers,
>>
>>                                         - Ted
>>
>> #!/bin/sh
>>
>> START=origin
>> URL=git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
>> END=""
>>
>> print_help ()
>> {
>>     PROG=$(basename "$0")
>>     echo "Usage: $PROG [-n] [--start <START COMMIT>] [--url <URL] [<END COMMIT>]"
>>     exit 1
>> }
>>
>> while [ "$1" != "" ]; do
>>     case $1 in
>>         --start) shift
>>                  START="$1"
>>                  ;;
>>         --url) shift
>>                URL="$1"
>>                ;;
>>         -n) NO_ACTION="echo" ;;
>>         -*) print_help ;;
>>         *)
>>             if test -n "$END"
>>             then
>>                 print_help
>>             else
>>                 END="$1"
>>             fi
>>             ;;
>>     esac
>>     shift
>> done
>>
>> $NO_ACTION git request-pull "$START" "$URL" "$END"
>>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 20:10 Proposal: "unadd" command / alias Filipp Bakanov
  2020-10-27 20:32 ` Junio C Hamano
@ 2020-10-28 12:13 ` Konstantin Tokarev
  2020-10-28 12:21   ` Filipp Bakanov
  2020-10-28 13:07 ` Pratyush Yadav
  2020-10-28 23:44 ` Junio C Hamano
  3 siblings, 1 reply; 12+ messages in thread
From: Konstantin Tokarev @ 2020-10-28 12:13 UTC (permalink / raw)
  To: Filipp Bakanov, git



27.10.2020, 23:10, "Filipp Bakanov" <filipp@bakanov.su>:
> 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

It can be done in shorter way: git reset 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.


-- 
Regards,
Konstantin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-28 12:13 ` Konstantin Tokarev
@ 2020-10-28 12:21   ` Filipp Bakanov
  0 siblings, 0 replies; 12+ messages in thread
From: Filipp Bakanov @ 2020-10-28 12:21 UTC (permalink / raw)
  To: Konstantin Tokarev; +Cc: git

Thank you, that solves the issue.

On Wed, 28 Oct 2020 at 15:13, Konstantin Tokarev <annulen@yandex.ru> wrote:
>
>
>
> 27.10.2020, 23:10, "Filipp Bakanov" <filipp@bakanov.su>:
> > 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
>
> It can be done in shorter way: git reset 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.
>
>
> --
> Regards,
> Konstantin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 20:10 Proposal: "unadd" command / alias Filipp Bakanov
  2020-10-27 20:32 ` Junio C Hamano
  2020-10-28 12:13 ` Konstantin Tokarev
@ 2020-10-28 13:07 ` Pratyush Yadav
  2020-10-28 13:56   ` Filipp Bakanov
  2020-10-28 23:44 ` Junio C Hamano
  3 siblings, 1 reply; 12+ messages in thread
From: Pratyush Yadav @ 2020-10-28 13:07 UTC (permalink / raw)
  To: Filipp Bakanov; +Cc: git

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-28 13:07 ` Pratyush Yadav
@ 2020-10-28 13:56   ` Filipp Bakanov
  0 siblings, 0 replies; 12+ messages in thread
From: Filipp Bakanov @ 2020-10-28 13:56 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: git

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Proposal: "unadd" command / alias.
  2020-10-27 20:10 Proposal: "unadd" command / alias Filipp Bakanov
                   ` (2 preceding siblings ...)
  2020-10-28 13:07 ` Pratyush Yadav
@ 2020-10-28 23:44 ` Junio C Hamano
  3 siblings, 0 replies; 12+ messages in thread
From: Junio C Hamano @ 2020-10-28 23:44 UTC (permalink / raw)
  To: Filipp Bakanov; +Cc: git

Filipp Bakanov <filipp@bakanov.su> writes:

> 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.

I am not sure if the behaviour of the "git reset HEAD -- path" is
what people would imagine what "unadd" would do, actually.  For
example, with this sequence:

    $ edit file
    $ git add file
    $ edit file
    $ git add file
    $ git unadd file

what would be the natural expectation of users after the last
"unadd" step?  Should it have the result of the first 'add'?  Should
another "git unadd file" bring the index back to the state before
the first 'add' was run?

There is no such ambiguity to "reset HEAD -- path".  It tells
exactly what contents you want to have in the index for the path
(i.e. the same as what is in HEAD).  There is no "go back to the
state before the last add", and there is no false hint that such a
thing might exist.

So, I do not think it is a good idea to even call it "unadd", let
alone adding an alias that is used outside your immediate circle
where you can explain what it exactly means to "unadd" by your
definition.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-10-29  1:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-10-28 23:44 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.