Commit Diff


commit - 8cfb4057347c76581c64b02802d4b9608bf56fd2
commit + 97b3a7beacbda58876c185d6aa2b1b9c305fa6f6
blob - 5b0caca573471a7115a0ac8bba32b020c9db5557
blob + 73e5c0ffe45e0fc90db1a713e9c8f9075ab559cb
--- got/got.1
+++ got/got.1
@@ -97,6 +97,9 @@ Only files beneath the specified
 .Ar path-prefix
 will be checked out.
 .El
+.It Cm co
+Short alias for
+.Cm checkout .
 .It Cm update [ Fl b Ar branch ] [ Fl c Ar commit ] [ Ar path ]
 Update an existing work tree to a different commit.
 Show the status of each affected file, using the following status codes:
@@ -147,6 +150,9 @@ automatically, provided the abbreviation is unique.
 If this option is not specified, the most recent commit on the work tree's
 branch will be used.
 .El
+.It Cm up
+Short alias for
+.Cm update .
 .It Cm status [ Ar path ]
 Show the current modification status of files in a work tree,
 using the following status codes:
@@ -164,6 +170,9 @@ using the following status codes:
 If a
 .Ar path
 is specified, only show modifications within this path.
+.It Cm st
+Short alias for
+.Cm status .
 .It Cm log [ Fl b ] [ Fl c Ar commit ] [ Fl C Ar number ] [ Fl l Ar N ] [ Fl p ] [ Fl r Ar repository-path ] [ path ]
 Display history of a repository.
 If a
@@ -356,6 +365,9 @@ List all existing branches in the repository.
 .It Fl d Ar name
 Delete the branch with the specified name from the repository.
 .El
+.It Cm br
+Short alias for
+.Cm branch .
 .It Cm add Ar file-path ...
 Schedule unversioned files in a work tree for addition to the
 repository in the next commit.
@@ -383,6 +395,9 @@ it will become an unversioned file again.
 If a file was deleted with
 .Cm got rm
 it will be restored.
+.It Cm rv
+Short alias for
+.Cm revert .
 .It Cm commit [ Fl m Ar message ] [ file-path ]
 Create a new commit in the repository from local changes in a work tree
 and use this commit as the new base commit for the work tree.
@@ -422,6 +437,9 @@ option,
 .Cm got commit
 opens a temporary file in an editor where a log message can be written.
 .El
+.It Cm ci
+Short alias for
+.Cm commit .
 .It Cm cherrypick Ar commit
 Merge changes from a single
 .Ar commit
@@ -462,6 +480,9 @@ to a single base commit with
 .Cm got update .
 If the work tree already contains files with merge conflicts, these
 conflicts must be resolved first.
+.It Cm ch
+Short alias for
+.Cm cherrypick .
 .It Cm backout Ar commit
 Reverse-merge changes from a single
 .Ar commit
@@ -502,6 +523,9 @@ to a single base commit with
 .Cm got update .
 If the work tree already contains files with merge conflicts, these
 conflicts must be resolved first.
+.It Cm bo
+Short alias for
+.Cm backout .
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width GOT_AUTHOR
blob - f51f008b5b3b03543c35038f7bde5d42c0a6a637
blob + e6a9bf7895318f3de7356a15f9b06c1234b7cbb8
--- got/got.c
+++ got/got.c
@@ -70,6 +70,7 @@ struct got_cmd {
 	const char	 *cmd_name;
 	const struct got_error *(*cmd_main)(int, char *[]);
 	void		(*cmd_usage)(void);
+	const char	*cmd_alias;
 };
 
 __dead static void	usage(void);
@@ -108,22 +109,22 @@ static const struct got_error*		cmd_cherrypick(int, ch
 static const struct got_error*		cmd_backout(int, char *[]);
 
 static struct got_cmd got_commands[] = {
-	{ "init",	cmd_init,	usage_init },
-	{ "checkout",	cmd_checkout,	usage_checkout },
-	{ "update",	cmd_update,	usage_update },
-	{ "log",	cmd_log,	usage_log },
-	{ "diff",	cmd_diff,	usage_diff },
-	{ "blame",	cmd_blame,	usage_blame },
-	{ "tree",	cmd_tree,	usage_tree },
-	{ "status",	cmd_status,	usage_status },
-	{ "ref",	cmd_ref,	usage_ref },
-	{ "branch",	cmd_branch,	usage_branch },
-	{ "add",	cmd_add,	usage_add },
-	{ "rm",		cmd_rm,		usage_rm },
-	{ "revert",	cmd_revert,	usage_revert },
-	{ "commit",	cmd_commit,	usage_commit },
-	{ "cherrypick",	cmd_cherrypick,	usage_cherrypick },
-	{ "backout",	cmd_backout,	usage_backout },
+	{ "init",	cmd_init,	usage_init,	"" },
+	{ "checkout",	cmd_checkout,	usage_checkout,	"co" },
+	{ "update",	cmd_update,	usage_update,	"up" },
+	{ "log",	cmd_log,	usage_log,	"" },
+	{ "diff",	cmd_diff,	usage_diff,	"" },
+	{ "blame",	cmd_blame,	usage_blame,	"" },
+	{ "tree",	cmd_tree,	usage_tree,	"" },
+	{ "status",	cmd_status,	usage_status,	"st" },
+	{ "ref",	cmd_ref,	usage_ref,	"" },
+	{ "branch",	cmd_branch,	usage_branch,	"br" },
+	{ "add",	cmd_add,	usage_add,	"" },
+	{ "rm",		cmd_rm,		usage_rm,	"" },
+	{ "revert",	cmd_revert,	usage_revert,	"rv" },
+	{ "commit",	cmd_commit,	usage_commit,	"ci" },
+	{ "cherrypick",	cmd_cherrypick,	usage_cherrypick, "ch" },
+	{ "backout",	cmd_backout,	usage_backout,	"bo" },
 };
 
 int
@@ -162,7 +163,8 @@ main(int argc, char *argv[])
 
 		cmd = &got_commands[i];
 
-		if (strncmp(cmd->cmd_name, argv[0], strlen(argv[0])))
+		if (strcmp(cmd->cmd_name, argv[0]) != 0 &&
+		    strcmp(cmd->cmd_alias, argv[0]) != 0)
 			continue;
 
 		if (hflag)