From: Ryan Schmitt <rschm...@u.rochester.edu>

This makes git-rm more consistent with git-diff, which also accepts
--staged as a synonym of --cached.

Signed-off-by: Ryan Schmitt <rschm...@pobox.com>
---
 Documentation/git-rm.txt | 2 +-
 builtin/rm.c             | 1 +
 t/t3600-rm.sh            | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git Documentation/git-rm.txt Documentation/git-rm.txt
index f1efc11..8635e67 100644
--- Documentation/git-rm.txt
+++ Documentation/git-rm.txt
@@ -58,7 +58,7 @@ OPTIONS
 --cached::
        Use this option to unstage and remove paths only from the index.
        Working tree files, whether modified or not, will be
-       left alone.
+       left alone. --staged is a synonym for --cached.
 
 --ignore-unmatch::
        Exit with a zero status even if no files matched.
diff --git builtin/rm.c builtin/rm.c
index 960634d..a88697b 100644
--- builtin/rm.c
+++ builtin/rm.c
@@ -269,6 +269,7 @@ static struct option builtin_rm_options[] = {
        OPT__DRY_RUN(&show_only, N_("dry run")),
        OPT__QUIET(&quiet, N_("do not list removed files")),
        OPT_BOOL( 0 , "cached",         &index_only, N_("only remove from the 
index")),
+       OPT_BOOL( 0 , "staged",         &index_only, N_("synonym for 
--cached")),
        OPT__FORCE(&force, N_("override the up-to-date check")),
        OPT_BOOL('r', NULL,             &recursive,  N_("allow recursive 
removal")),
        OPT_BOOL( 0 , "ignore-unmatch", &ignore_unmatch,
diff --git t/t3600-rm.sh t/t3600-rm.sh
index 3d30581..c32dbf4 100755
--- t/t3600-rm.sh
+++ t/t3600-rm.sh
@@ -72,6 +72,12 @@ test_expect_success \
      git rm --cached -f foo'
 
 test_expect_success \
+    'Test that git rm --staged foo is synonymous with git rm --cached foo' \
+    'echo content > foo
+     git add foo
+     git rm --staged foo'
+
+test_expect_success \
     'Post-check that foo exists but is not in index after git rm foo' \
     '[ -f foo ] && test_must_fail git ls-files --error-unmatch foo'
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to