Skip to content

Commit e17dba8

Browse files
pcloudsgitster
authored andcommitted
remote: prefer subcommand name 'remove' to 'rm'
All remote subcommands are spelled out words except 'rm'. 'rm', being a popular UNIX command name, may mislead users that there are also 'ls' or 'mv'. Use 'remove' to fit with the rest of subcommands. 'rm' is still supported and used in the test suite. It's just not widely advertised. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 871e293 commit e17dba8

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Documentation/git-remote.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SYNOPSIS
1212
'git remote' [-v | --verbose]
1313
'git remote add' [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>
1414
'git remote rename' <old> <new>
15-
'git remote rm' <name>
15+
'git remote remove' <name>
1616
'git remote set-head' <name> (-a | -d | <branch>)
1717
'git remote set-branches' [--add] <name> <branch>...
1818
'git remote set-url' [--push] <name> <newurl> [<oldurl>]
@@ -85,6 +85,7 @@ In case <old> and <new> are the same, and <old> is a file under
8585
`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
8686
the configuration file format.
8787

88+
'remove'::
8889
'rm'::
8990

9091
Remove the remote named <name>. All remote-tracking branches and

builtin/remote.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static const char * const builtin_remote_usage[] = {
1111
"git remote [-v | --verbose]",
1212
"git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>",
1313
"git remote rename <old> <new>",
14-
"git remote rm <name>",
14+
"git remote remove <name>",
1515
"git remote set-head <name> (-a | -d | <branch>)",
1616
"git remote [-v | --verbose] show [-n] <name>",
1717
"git remote prune [-n | --dry-run] <name>",
@@ -34,7 +34,7 @@ static const char * const builtin_remote_rename_usage[] = {
3434
};
3535

3636
static const char * const builtin_remote_rm_usage[] = {
37-
"git remote rm <name>",
37+
"git remote remove <name>",
3838
NULL
3939
};
4040

@@ -1580,7 +1580,7 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
15801580
result = add(argc, argv);
15811581
else if (!strcmp(argv[0], "rename"))
15821582
result = mv(argc, argv);
1583-
else if (!strcmp(argv[0], "rm"))
1583+
else if (!strcmp(argv[0], "rm") || !strcmp(argv[0], "remove"))
15841584
result = rm(argc, argv);
15851585
else if (!strcmp(argv[0], "set-head"))
15861586
result = set_head(argc, argv);

contrib/completion/git-completion.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,15 +2032,15 @@ _git_config ()
20322032

20332033
_git_remote ()
20342034
{
2035-
local subcommands="add rename rm set-head set-branches set-url show prune update"
2035+
local subcommands="add rename remove set-head set-branches set-url show prune update"
20362036
local subcommand="$(__git_find_on_cmdline "$subcommands")"
20372037
if [ -z "$subcommand" ]; then
20382038
__gitcomp "$subcommands"
20392039
return
20402040
fi
20412041

20422042
case "$subcommand" in
2043-
rename|rm|set-url|show|prune)
2043+
rename|remove|set-url|show|prune)
20442044
__gitcomp_nl "$(__git_remotes)"
20452045
;;
20462046
set-head|set-branches)

t/t5505-remote.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ EOF
125125
} &&
126126
git tag footag &&
127127
git config --add remote.oops.fetch "+refs/*:refs/*" &&
128-
git remote rm oops 2>actual1 &&
128+
git remote remove oops 2>actual1 &&
129129
git branch foobranch &&
130130
git config --add remote.oops.fetch "+refs/*:refs/*" &&
131131
git remote rm oops 2>actual2 &&
@@ -672,7 +672,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
672672
git clone one five &&
673673
origin_url=$(pwd)/one &&
674674
(cd five &&
675-
git remote rm origin &&
675+
git remote remove origin &&
676676
mkdir -p .git/remotes &&
677677
cat ../remotes_origin > .git/remotes/origin &&
678678
git remote rename origin origin &&

t/t5540-http-push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ test_expect_success 'http-push fetches packed objects' '
117117
# By reset, we force git to retrieve the packed object
118118
(cd "$ROOT_PATH"/test_repo_clone_packed &&
119119
git reset --hard HEAD^ &&
120-
git remote rm origin &&
120+
git remote remove origin &&
121121
git reflog expire --expire=0 --all &&
122122
git prune &&
123123
git push -f -v $HTTPD_URL/dumb/test_repo_packed.git master)

0 commit comments

Comments
 (0)