Skip to content

Commit

Permalink
remote: prefer subcommand name 'remove' to 'rm'
Browse files Browse the repository at this point in the history
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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Sep 6, 2012
1 parent 871e293 commit e17dba8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-remote.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SYNOPSIS
'git remote' [-v | --verbose]
'git remote add' [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>
'git remote rename' <old> <new>
'git remote rm' <name>
'git remote remove' <name>
'git remote set-head' <name> (-a | -d | <branch>)
'git remote set-branches' [--add] <name> <branch>...
'git remote set-url' [--push] <name> <newurl> [<oldurl>]
Expand Down Expand Up @@ -85,6 +85,7 @@ In case <old> and <new> are the same, and <old> is a file under
`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
the configuration file format.

'remove'::
'rm'::

Remove the remote named <name>. All remote-tracking branches and
Expand Down
6 changes: 3 additions & 3 deletions builtin/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static const char * const builtin_remote_usage[] = {
"git remote [-v | --verbose]",
"git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>",
"git remote rename <old> <new>",
"git remote rm <name>",
"git remote remove <name>",
"git remote set-head <name> (-a | -d | <branch>)",
"git remote [-v | --verbose] show [-n] <name>",
"git remote prune [-n | --dry-run] <name>",
Expand All @@ -34,7 +34,7 @@ static const char * const builtin_remote_rename_usage[] = {
};

static const char * const builtin_remote_rm_usage[] = {
"git remote rm <name>",
"git remote remove <name>",
NULL
};

Expand Down Expand Up @@ -1580,7 +1580,7 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
result = add(argc, argv);
else if (!strcmp(argv[0], "rename"))
result = mv(argc, argv);
else if (!strcmp(argv[0], "rm"))
else if (!strcmp(argv[0], "rm") || !strcmp(argv[0], "remove"))
result = rm(argc, argv);
else if (!strcmp(argv[0], "set-head"))
result = set_head(argc, argv);
Expand Down
4 changes: 2 additions & 2 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2032,15 +2032,15 @@ _git_config ()

_git_remote ()
{
local subcommands="add rename rm set-head set-branches set-url show prune update"
local subcommands="add rename remove set-head set-branches set-url show prune update"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
fi

case "$subcommand" in
rename|rm|set-url|show|prune)
rename|remove|set-url|show|prune)
__gitcomp_nl "$(__git_remotes)"
;;
set-head|set-branches)
Expand Down
4 changes: 2 additions & 2 deletions t/t5505-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ EOF
} &&
git tag footag &&
git config --add remote.oops.fetch "+refs/*:refs/*" &&
git remote rm oops 2>actual1 &&
git remote remove oops 2>actual1 &&
git branch foobranch &&
git config --add remote.oops.fetch "+refs/*:refs/*" &&
git remote rm oops 2>actual2 &&
Expand Down Expand Up @@ -672,7 +672,7 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
git clone one five &&
origin_url=$(pwd)/one &&
(cd five &&
git remote rm origin &&
git remote remove origin &&
mkdir -p .git/remotes &&
cat ../remotes_origin > .git/remotes/origin &&
git remote rename origin origin &&
Expand Down
2 changes: 1 addition & 1 deletion t/t5540-http-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test_expect_success 'http-push fetches packed objects' '
# By reset, we force git to retrieve the packed object
(cd "$ROOT_PATH"/test_repo_clone_packed &&
git reset --hard HEAD^ &&
git remote rm origin &&
git remote remove origin &&
git reflog expire --expire=0 --all &&
git prune &&
git push -f -v $HTTPD_URL/dumb/test_repo_packed.git master)
Expand Down

0 comments on commit e17dba8

Please sign in to comment.