{"thread":{"id":"54516","subject":"Proposal: \"unadd\" command / alias.","startedAt":"2020-10-27T20:10:15Z","lastAt":"2020-10-29T01:05:10Z","messageCount":12,"participants":["Filipp Bakanov","Junio C Hamano","Theodore Y. Ts'o","Pratyush Yadav","Philip Oakley","Konstantin Tokarev"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"408525","messageId":"CAAdniQ5pRHKUU77XVmZkZ_gUgfYYFpo9=Xt2T6EgzJ3hoT0YMg@mail.gmail.com","threadId":"54516","inReplyTo":null,"subject":"Proposal: \"unadd\" command / alias.","fromName":"Filipp Bakanov","fromEmail":"filipp@bakanov.su","sentAt":"2020-10-27T20:10:00Z","receivedAt":"2020-10-27T20:10:15Z","isPatch":false,"sender":{"key":"filipp@bakanov.su","avatar":"https://gravatar.com/avatar/d134880f5b23604c2e4c7711ccf95c9d2fd42ad6d7e21d1f2f2e215ef7ab6995?d=mp&s=160"},"body":"Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n\ngit unadd path/to/file\n\nIt will be an alias to:\n\ngit reset HEAD -- path/to/file\n\nThe motivation is that I always forget syntax and have to google each\ntime I want to undo accidentally added files. Unadd is just much\neasier to remember and quite obvious.\n"},{"id":"408529","messageId":"xmqqblgnbea5.fsf@gitster.c.googlers.com","threadId":"54516","inReplyTo":"CAAdniQ5pRHKUU77XVmZkZ_gUgfYYFpo9=Xt2T6EgzJ3hoT0YMg@mail.gmail.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-27T20:32:50Z","receivedAt":"2020-10-27T20:32:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Filipp Bakanov <filipp@bakanov.su> writes:\n\n> Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n>\n> git unadd path/to/file\n>\n> It will be an alias to:\n>\n> git reset HEAD -- path/to/file\n>\n> The motivation is that I always forget syntax and have to google each\n> time I want to undo accidentally added files. Unadd is just much\n> easier to remember and quite obvious.\n\nThe alias is for you to do the above, I think.\n"},{"id":"408534","messageId":"20201027215638.GI5691@mit.edu","threadId":"54516","inReplyTo":"xmqqblgnbea5.fsf@gitster.c.googlers.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Theodore Y. Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2020-10-27T21:56:38Z","receivedAt":"2020-10-27T21:56:47Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Tue, Oct 27, 2020 at 01:32:50PM -0700, Junio C Hamano wrote:\n> Filipp Bakanov <filipp@bakanov.su> writes:\n> \n> > Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n> >\n> > git unadd path/to/file\n> >\n> > It will be an alias to:\n> >\n> > git reset HEAD -- path/to/file\n> >\n> > The motivation is that I always forget syntax and have to google each\n> > time I want to undo accidentally added files. Unadd is just much\n> > easier to remember and quite obvious.\n> \n> The alias is for you to do the above, I think.\n\nFilipp,\n\nIndeed, I have a similar alias in my ~/.gitconfig\n\n[alias]\n\trevert-file = checkout HEAD --\n\nAdding\n\n[alias]\n\tunadd = reset HEAD --\n\nto your .gitconfig would do what you want.  As a BTW, my favorite\nalias is:\n\n   lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n\nSample usage: \"git lgt origin..\" or \"git lgt -10\".\n\nCheers,\n\n\t\t\t\t\t- Ted\n"},{"id":"408536","messageId":"CAAdniQ4vx4z9KnfvG7thzxf1xBa=P_nnbY1G=RTFUBb4Zxqeaw@mail.gmail.com","threadId":"54516","inReplyTo":"20201027215638.GI5691@mit.edu","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Filipp Bakanov","fromEmail":"filipp@bakanov.su","sentAt":"2020-10-27T22:02:11Z","receivedAt":"2020-10-27T22:02:24Z","isPatch":false,"sender":{"key":"filipp@bakanov.su","avatar":"https://gravatar.com/avatar/d134880f5b23604c2e4c7711ccf95c9d2fd42ad6d7e21d1f2f2e215ef7ab6995?d=mp&s=160"},"body":">> Indeed, I have a similar alias in my ~/.gitconfig\n\nWhy not just add it to git by default for everybody? revert-file is\nalso ok, anything except `checkout HEAD --` will be good.\n\nOn Wed, 28 Oct 2020 at 00:56, Theodore Y. Ts'o <tytso@mit.edu> wrote:\n>\n> On Tue, Oct 27, 2020 at 01:32:50PM -0700, Junio C Hamano wrote:\n> > Filipp Bakanov <filipp@bakanov.su> writes:\n> >\n> > > Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n> > >\n> > > git unadd path/to/file\n> > >\n> > > It will be an alias to:\n> > >\n> > > git reset HEAD -- path/to/file\n> > >\n> > > The motivation is that I always forget syntax and have to google each\n> > > time I want to undo accidentally added files. Unadd is just much\n> > > easier to remember and quite obvious.\n> >\n> > The alias is for you to do the above, I think.\n>\n> Filipp,\n>\n> Indeed, I have a similar alias in my ~/.gitconfig\n>\n> [alias]\n>         revert-file = checkout HEAD --\n>\n> Adding\n>\n> [alias]\n>         unadd = reset HEAD --\n>\n> to your .gitconfig would do what you want.  As a BTW, my favorite\n> alias is:\n>\n>    lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>\n> Sample usage: \"git lgt origin..\" or \"git lgt -10\".\n>\n> Cheers,\n>\n>                                         - Ted\n"},{"id":"408539","messageId":"20201027225403.GJ5691@mit.edu","threadId":"54516","inReplyTo":"CAAdniQ4vx4z9KnfvG7thzxf1xBa=P_nnbY1G=RTFUBb4Zxqeaw@mail.gmail.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Theodore Y. Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2020-10-27T22:54:03Z","receivedAt":"2020-10-27T22:54:12Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Wed, Oct 28, 2020 at 01:02:11AM +0300, Filipp Bakanov wrote:\n> >> Indeed, I have a similar alias in my ~/.gitconfig\n> \n> Why not just add it to git by default for everybody? revert-file is\n> also ok, anything except `checkout HEAD --` will be good.\n\nBecause everyone may have their own favorite aliases?  Just because\n*I* have the following aliases doesn't mean that everyone else would\nfind them useful.\n\n[alias]\n\tnew = !gitk --all --not ORIG_HEAD\n\tdw = diff --stat --summary\n\tdi = diff --stat --summary --cached\n\tdc = describe --contains\n\trevert-file = checkout HEAD --\n\tl  = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n\tlr = log --reverse --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n\trl  = log -g --pretty=format:'%Cred%h%Creset %gd %gs %Cgreen(%gr)%Creset %s' --abbrev-commit\n\trl1  = log -g --date=relative --pretty=format:'%Cred%h%Creset %gs %Cgreen%gd%Creset %s' --abbrev-commit\n\tlg  = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n\tlgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n\trlt = log -g --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n\tlgt-nc = log --graph --pretty=format:'%h -%d %s (%cr)' --abbrev-commit\n\tst = status -s\n\trecent = for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'\n\tgerrit-clone = !bash ggh gerrit-clone\n\tstart = !bash ggh start\n\tupload = !bash ggh upload\n\tprune-branches = !bash ggh prune-branches\n\tfixes = log -1 --pretty=fixes\n\nI have a huge number of bash aliases, and that doesn't mean everyone\nelse should have those bash aliases.  For that matter, I have the\nfollowing in ~/bin/git-rp-ext4 so that I can type \"git rp-ext4\ntags/ext4_for_linus\".  But that doesn't mean this script is right for\neveryone....\n\nCheers,\n\n\t\t\t\t\t- Ted\n\n#!/bin/sh\n\nSTART=origin\nURL=git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git\nEND=\"\"\n\nprint_help ()\n{\n    PROG=$(basename \"$0\")\n    echo \"Usage: $PROG [-n] [--start <START COMMIT>] [--url <URL] [<END COMMIT>]\"\n    exit 1\n}\n\nwhile [ \"$1\" != \"\" ]; do\n    case $1 in\n\t--start) shift\n\t\t START=\"$1\"\n\t\t ;;\n\t--url) shift\n\t       URL=\"$1\"\n\t       ;;\n\t-n) NO_ACTION=\"echo\" ;;\n\t-*) print_help ;;\n\t*)\n\t    if test -n \"$END\"\n\t    then\n\t\tprint_help\n\t    else\n\t\tEND=\"$1\"\n\t    fi\n\t    ;;\n    esac\n    shift\ndone\n\n$NO_ACTION git request-pull \"$START\" \"$URL\" \"$END\"\n\n"},{"id":"408550","messageId":"CAAdniQ7o2greovkG-RP-FLwW2OH3YuiORwB+QKgqy=_0aJ4XkQ@mail.gmail.com","threadId":"54516","inReplyTo":"20201027225403.GJ5691@mit.edu","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Filipp Bakanov","fromEmail":"filipp@bakanov.su","sentAt":"2020-10-27T23:14:05Z","receivedAt":"2020-10-28T01:48:12Z","isPatch":false,"sender":{"key":"filipp@bakanov.su","avatar":"https://gravatar.com/avatar/d134880f5b23604c2e4c7711ccf95c9d2fd42ad6d7e21d1f2f2e215ef7ab6995?d=mp&s=160"},"body":"It's the matter of UX. If many users have to make an alias for the\nsame unclear command, at least it's a point to think about making this\nparticular command more convenient. As far as I remember, some aliases\nwere already added to git by default.\nWhat's bad with adding a popular (among many users) aliases, if they\nimprove UX and make life easier?\n\nOn Wed, 28 Oct 2020 at 01:54, Theodore Y. Ts'o <tytso@mit.edu> wrote:\n>\n> On Wed, Oct 28, 2020 at 01:02:11AM +0300, Filipp Bakanov wrote:\n> > >> Indeed, I have a similar alias in my ~/.gitconfig\n> >\n> > Why not just add it to git by default for everybody? revert-file is\n> > also ok, anything except `checkout HEAD --` will be good.\n>\n> Because everyone may have their own favorite aliases?  Just because\n> *I* have the following aliases doesn't mean that everyone else would\n> find them useful.\n>\n> [alias]\n>         new = !gitk --all --not ORIG_HEAD\n>         dw = diff --stat --summary\n>         di = diff --stat --summary --cached\n>         dc = describe --contains\n>         revert-file = checkout HEAD --\n>         l  = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>         lr = log --reverse --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>         rl  = log -g --pretty=format:'%Cred%h%Creset %gd %gs %Cgreen(%gr)%Creset %s' --abbrev-commit\n>         rl1  = log -g --date=relative --pretty=format:'%Cred%h%Creset %gs %Cgreen%gd%Creset %s' --abbrev-commit\n>         lg  = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>         lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>         rlt = log -g --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>         lgt-nc = log --graph --pretty=format:'%h -%d %s (%cr)' --abbrev-commit\n>         st = status -s\n>         recent = for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'\n>         gerrit-clone = !bash ggh gerrit-clone\n>         start = !bash ggh start\n>         upload = !bash ggh upload\n>         prune-branches = !bash ggh prune-branches\n>         fixes = log -1 --pretty=fixes\n>\n> I have a huge number of bash aliases, and that doesn't mean everyone\n> else should have those bash aliases.  For that matter, I have the\n> following in ~/bin/git-rp-ext4 so that I can type \"git rp-ext4\n> tags/ext4_for_linus\".  But that doesn't mean this script is right for\n> everyone....\n>\n> Cheers,\n>\n>                                         - Ted\n>\n> #!/bin/sh\n>\n> START=origin\n> URL=git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git\n> END=\"\"\n>\n> print_help ()\n> {\n>     PROG=$(basename \"$0\")\n>     echo \"Usage: $PROG [-n] [--start <START COMMIT>] [--url <URL] [<END COMMIT>]\"\n>     exit 1\n> }\n>\n> while [ \"$1\" != \"\" ]; do\n>     case $1 in\n>         --start) shift\n>                  START=\"$1\"\n>                  ;;\n>         --url) shift\n>                URL=\"$1\"\n>                ;;\n>         -n) NO_ACTION=\"echo\" ;;\n>         -*) print_help ;;\n>         *)\n>             if test -n \"$END\"\n>             then\n>                 print_help\n>             else\n>                 END=\"$1\"\n>             fi\n>             ;;\n>     esac\n>     shift\n> done\n>\n> $NO_ACTION git request-pull \"$START\" \"$URL\" \"$END\"\n>\n"},{"id":"408561","messageId":"87eelifqii.fsf@yadavpratyush.com","threadId":"54516","inReplyTo":"CAAdniQ5pRHKUU77XVmZkZ_gUgfYYFpo9=Xt2T6EgzJ3hoT0YMg@mail.gmail.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2020-10-28T13:07:17Z","receivedAt":"2020-10-28T22:03:33Z","isPatch":false,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On Tue, Oct 27 2020, Filipp Bakanov wrote:\n\n> Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n>\n> git unadd path/to/file\n>\n> It will be an alias to:\n>\n> git reset HEAD -- path/to/file\n>\n> The motivation is that I always forget syntax and have to google each\n> time I want to undo accidentally added files. Unadd is just much\n> easier to remember and quite obvious.\n\nWhy do you need to Google when `git status` tells you how to do it?\n\n    $ touch foo\n    $ git add foo\n    $ git status\n    On branch master\n    Your branch is up to date with 'origin/master'.\n\n    Changes to be committed:\n      (use \"git restore --staged <file>...\" to unstage)\n    \tnew file:   foo\n    \n    $ git restore --staged foo\n    $ git status\n    On branch master\n    Your branch is up to date with 'origin/master'.\n\n    Untracked files:\n      (use \"git add <file>...\" to include in what will be committed)\n    \tfoo\n\n    nothing added to commit but untracked files present (use \"git add\" to track)\n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"408570","messageId":"CAAdniQ5Mj0svFKeDPtDV9mNeFfHY+7vznn1EVN2DO6tb5Qe4Jw@mail.gmail.com","threadId":"54516","inReplyTo":"3956141603887148@mail.yandex.ru","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Filipp Bakanov","fromEmail":"filipp@bakanov.su","sentAt":"2020-10-28T12:21:02Z","receivedAt":"2020-10-28T22:41:29Z","isPatch":false,"sender":{"key":"filipp@bakanov.su","avatar":"https://gravatar.com/avatar/d134880f5b23604c2e4c7711ccf95c9d2fd42ad6d7e21d1f2f2e215ef7ab6995?d=mp&s=160"},"body":"Thank you, that solves the issue.\n\nOn Wed, 28 Oct 2020 at 15:13, Konstantin Tokarev <annulen@yandex.ru> wrote:\n>\n>\n>\n> 27.10.2020, 23:10, \"Filipp Bakanov\" <filipp@bakanov.su>:\n> > Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n> >\n> > git unadd path/to/file\n> >\n> > It will be an alias to:\n> >\n> > git reset HEAD -- path/to/file\n>\n> It can be done in shorter way: git reset path/to/file\n>\n> >\n> > The motivation is that I always forget syntax and have to google each\n> > time I want to undo accidentally added files. Unadd is just much\n> > easier to remember and quite obvious.\n>\n>\n> --\n> Regards,\n> Konstantin\n"},{"id":"408575","messageId":"CAAdniQ7TGuv0uFjwPOYfzo7zS0v-tEJ9kSWwB86Hjg0XstOE7A@mail.gmail.com","threadId":"54516","inReplyTo":"87eelifqii.fsf@yadavpratyush.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Filipp Bakanov","fromEmail":"filipp@bakanov.su","sentAt":"2020-10-28T13:56:50Z","receivedAt":"2020-10-28T22:50:50Z","isPatch":false,"sender":{"key":"filipp@bakanov.su","avatar":"https://gravatar.com/avatar/d134880f5b23604c2e4c7711ccf95c9d2fd42ad6d7e21d1f2f2e215ef7ab6995?d=mp&s=160"},"body":"Thank you for mentioning git restore.\n\nAnswering to your question, my brain filtered all the output of git\nstatus except \"modified: ...\"\nThere are multiple reasons:\n - command named restore. I don't know what it will restore. Maybe it\nwill restore a clean version? Maybe it will remove all my changes? I\ndon't want to risk.\n - I don't know what means \"unstage\". I didn't run \"git stage\" to add\nmy files, why should I run git restore --staged to undo git add? If\ncommand would be named \"git unadd\" and description would be \"undo git\nadd\", it would be more obvious than git restore --staged or git reset.\n I asked my friends, no one remembered how to undo git add. One said:\n \" - May be it's git reset but I'm not sure, need to check before\napply\". And he agreed that \"git unadd\" would be a more obvious.\n\nOn Wed, 28 Oct 2020 at 16:07, Pratyush Yadav <me@yadavpratyush.com> wrote:\n>\n> On Tue, Oct 27 2020, Filipp Bakanov wrote:\n>\n> > Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n> >\n> > git unadd path/to/file\n> >\n> > It will be an alias to:\n> >\n> > git reset HEAD -- path/to/file\n> >\n> > The motivation is that I always forget syntax and have to google each\n> > time I want to undo accidentally added files. Unadd is just much\n> > easier to remember and quite obvious.\n>\n> Why do you need to Google when `git status` tells you how to do it?\n>\n>     $ touch foo\n>     $ git add foo\n>     $ git status\n>     On branch master\n>     Your branch is up to date with 'origin/master'.\n>\n>     Changes to be committed:\n>       (use \"git restore --staged <file>...\" to unstage)\n>         new file:   foo\n>\n>     $ git restore --staged foo\n>     $ git status\n>     On branch master\n>     Your branch is up to date with 'origin/master'.\n>\n>     Untracked files:\n>       (use \"git add <file>...\" to include in what will be committed)\n>         foo\n>\n>     nothing added to commit but untracked files present (use \"git add\" to track)\n>\n> --\n> Regards,\n> Pratyush Yadav\n"},{"id":"408587","messageId":"126f0324-2d5b-c2a9-b1ca-aa92909b6fde@iee.email","threadId":"54516","inReplyTo":"CAAdniQ7o2greovkG-RP-FLwW2OH3YuiORwB+QKgqy=_0aJ4XkQ@mail.gmail.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2020-10-28T11:00:38Z","receivedAt":"2020-10-28T23:29:12Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 27/10/2020 23:14, Filipp Bakanov wrote:\n> It's the matter of UX. If many users have to make an alias for the\n> same unclear command, at least it's a point to think about making this\n> particular command more convenient. As far as I remember, some aliases\n> were already added to git by default.\n> What's bad with adding a popular (among many users) aliases, if they\n> improve UX and make life easier?\n\nOne option maybe to curate a few of the more popular aliases within a\ncontrib/aliases file/directory.\n\nNot sure how best to add comments into the alias file so folks can\nremember what they are really meant to do, or where they copied them from.\n\nPhilip\n\n>\n> On Wed, 28 Oct 2020 at 01:54, Theodore Y. Ts'o <tytso@mit.edu> wrote:\n>> On Wed, Oct 28, 2020 at 01:02:11AM +0300, Filipp Bakanov wrote:\n>>>>> Indeed, I have a similar alias in my ~/.gitconfig\n>>> Why not just add it to git by default for everybody? revert-file is\n>>> also ok, anything except `checkout HEAD --` will be good.\n>> Because everyone may have their own favorite aliases?  Just because\n>> *I* have the following aliases doesn't mean that everyone else would\n>> find them useful.\n>>\n>> [alias]\n>>         new = !gitk --all --not ORIG_HEAD\n>>         dw = diff --stat --summary\n>>         di = diff --stat --summary --cached\n>>         dc = describe --contains\n>>         revert-file = checkout HEAD --\n>>         l  = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>>         lr = log --reverse --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>>         rl  = log -g --pretty=format:'%Cred%h%Creset %gd %gs %Cgreen(%gr)%Creset %s' --abbrev-commit\n>>         rl1  = log -g --date=relative --pretty=format:'%Cred%h%Creset %gs %Cgreen%gd%Creset %s' --abbrev-commit\n>>         lg  = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>>         lgt = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>>         rlt = log -g --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit\n>>         lgt-nc = log --graph --pretty=format:'%h -%d %s (%cr)' --abbrev-commit\n>>         st = status -s\n>>         recent = for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'\n>>         gerrit-clone = !bash ggh gerrit-clone\n>>         start = !bash ggh start\n>>         upload = !bash ggh upload\n>>         prune-branches = !bash ggh prune-branches\n>>         fixes = log -1 --pretty=fixes\n>>\n>> I have a huge number of bash aliases, and that doesn't mean everyone\n>> else should have those bash aliases.  For that matter, I have the\n>> following in ~/bin/git-rp-ext4 so that I can type \"git rp-ext4\n>> tags/ext4_for_linus\".  But that doesn't mean this script is right for\n>> everyone....\n>>\n>> Cheers,\n>>\n>>                                         - Ted\n>>\n>> #!/bin/sh\n>>\n>> START=origin\n>> URL=git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git\n>> END=\"\"\n>>\n>> print_help ()\n>> {\n>>     PROG=$(basename \"$0\")\n>>     echo \"Usage: $PROG [-n] [--start <START COMMIT>] [--url <URL] [<END COMMIT>]\"\n>>     exit 1\n>> }\n>>\n>> while [ \"$1\" != \"\" ]; do\n>>     case $1 in\n>>         --start) shift\n>>                  START=\"$1\"\n>>                  ;;\n>>         --url) shift\n>>                URL=\"$1\"\n>>                ;;\n>>         -n) NO_ACTION=\"echo\" ;;\n>>         -*) print_help ;;\n>>         *)\n>>             if test -n \"$END\"\n>>             then\n>>                 print_help\n>>             else\n>>                 END=\"$1\"\n>>             fi\n>>             ;;\n>>     esac\n>>     shift\n>> done\n>>\n>> $NO_ACTION git request-pull \"$START\" \"$URL\" \"$END\"\n>>\n\n"},{"id":"408592","messageId":"xmqqmu059arb.fsf@gitster.c.googlers.com","threadId":"54516","inReplyTo":"CAAdniQ5pRHKUU77XVmZkZ_gUgfYYFpo9=Xt2T6EgzJ3hoT0YMg@mail.gmail.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-28T23:44:08Z","receivedAt":"2020-10-28T23:44:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Filipp Bakanov <filipp@bakanov.su> writes:\n\n> Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n>\n> git unadd path/to/file\n>\n> It will be an alias to:\n>\n> git reset HEAD -- path/to/file\n>\n> The motivation is that I always forget syntax and have to google each\n> time I want to undo accidentally added files. Unadd is just much\n> easier to remember and quite obvious.\n\nI am not sure if the behaviour of the \"git reset HEAD -- path\" is\nwhat people would imagine what \"unadd\" would do, actually.  For\nexample, with this sequence:\n\n    $ edit file\n    $ git add file\n    $ edit file\n    $ git add file\n    $ git unadd file\n\nwhat would be the natural expectation of users after the last\n\"unadd\" step?  Should it have the result of the first 'add'?  Should\nanother \"git unadd file\" bring the index back to the state before\nthe first 'add' was run?\n\nThere is no such ambiguity to \"reset HEAD -- path\".  It tells\nexactly what contents you want to have in the index for the path\n(i.e. the same as what is in HEAD).  There is no \"go back to the\nstate before the last add\", and there is no false hint that such a\nthing might exist.\n\nSo, I do not think it is a good idea to even call it \"unadd\", let\nalone adding an alias that is used outside your immediate circle\nwhere you can explain what it exactly means to \"unadd\" by your\ndefinition.\n"},{"id":"408608","messageId":"3956141603887148@mail.yandex.ru","threadId":"54516","inReplyTo":"CAAdniQ5pRHKUU77XVmZkZ_gUgfYYFpo9=Xt2T6EgzJ3hoT0YMg@mail.gmail.com","subject":"Re: Proposal: \"unadd\" command / alias.","fromName":"Konstantin Tokarev","fromEmail":"annulen@yandex.ru","sentAt":"2020-10-28T12:13:11Z","receivedAt":"2020-10-29T01:05:10Z","isPatch":false,"sender":{"key":"annulen@yandex.ru","avatar":null},"body":"\n\n27.10.2020, 23:10, \"Filipp Bakanov\" <filipp@bakanov.su>:\n> Hi! I suggest to add \"unadd\" command, that will undo a git add command.\n>\n> git unadd path/to/file\n>\n> It will be an alias to:\n>\n> git reset HEAD -- path/to/file\n\nIt can be done in shorter way: git reset path/to/file\n\n>\n> The motivation is that I always forget syntax and have to google each\n> time I want to undo accidentally added files. Unadd is just much\n> easier to remember and quite obvious.\n\n\n-- \nRegards,\nKonstantin\n"}]}