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

[PATCH 2] renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckout

From
MWMarc Weber <marco-oweber@gmx.de>
Date
Oct 5, 2008, 21:46 UTC
Message-ID
<20081005214644.GB32727@gmx.de>
In-Reply-To
<20081005164124.GA31903@coredump.intra.peff.net>

Hi Jeff, thanks! I'll try to do it better now (not sure who is the mantainer though, I've seen that you've commited some lines to this file)..

Both patches apply cleanly against c427559 (master). You can push enhancements directly to

git://mawercer.de/git_my_patches 
topic branches: 
        renaming_revert_to_reset
        revert_to_reset_renaming

Sincerly Marc Weber

============= attachement git show output ============================
commit 852b21bf88b1de784244a6e99de9a53a5c61dd8c
Author: Marc Weber <marco-oweber@gmx.de>
Date:   Sun Oct 5 23:09:04 2008 +0200
    rename the git add -i [r]evert command to [r]eset to use the same term as in git reset
    purpose: decrease possibility of confusion for users with svn background (svn revert = git checkout)
    
    Signed-off-by: Marc Weber <marco-oweber@gmx.de>
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..5352d16 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,7 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
        }
        print "\n";
 }
@@ -1046,7 +1046,7 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of changes
@@ -1070,7 +1070,7 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],








commit b3d438764a7429e1dfacef8f499a0126076ed2bc
Author: Marc Weber <marco-oweber@gmx.de>
Date:   Sun Oct 5 15:15:38 2008 +0000

    renamed revert in ga -i to reset, added [c]heckout

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..32c300f 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,31 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
+       }
+       print "\n";
+}
+
+sub checkout_cmd {
+       my @update = list_and_choose({ PROMPT => 'Checkout',
+                                      HEADER => $status_head, },
+                                    list_modified());
+       if (@update) {
+               if (is_initial_commit()) {
+                        # should never be executed because there can't
be modified files
+                        print "error: no revision in repo yet\n";
+               }
+               else {
+                       for (@update) {
+                               if ($_->{INDEX_ADDDEL} &&
+                                   $_->{INDEX_ADDDEL} eq 'create') {
+                                       system(qw(git checkout --),
+                                              $_->{VALUE});
+                               }
+                       }
+               }
+               refresh();
+               say_n_paths('checked out', @update);
        }
        print "\n";
 }
@@ -1046,7 +1070,8 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
+checkout      - reset working copy file back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of
changes
@@ -1070,7 +1095,8 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
+                  [ 'checkout', \&checkout_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],
Previous: Jeff KingNext: Jeff King
Message 3 of 10 in “What about renaming ga -i [r]evert to [r]eset ?”
  1. Marc WeberOct 5, 2008
  2. Jeff KingOct 5, 2008
  3. renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckoutMarc Weber, Oct 5, 2008
  4. Jeff KingOct 5, 2008
  5. 1/2 add--interactive: rename [r]evert command to [r]esetMarc Weber, Oct 6, 2008
  6. 2/2 add--interactive: added [c]heckoutMarc Weber, Oct 6, 2008
  7. Shawn O. PearceOct 6, 2008
  8. Marc WeberOct 6, 2008
  9. Shawn O. PearceOct 6, 2008
  10. Marc WeberOct 6, 2008

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.