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

[PATCH] Modified the default git help message to be grouped by topic

From
Scott Chacon <schacon@gmail.com>
Date
Dec 1, 2008, 17:30 UTC
Message-ID
<20081201173037.GA41967@agadorsparticus>

It's difficult to process 21 commands (which is what is output by default for git when no command is given). I've re-grouped them into 4 groups of 5 or 6 commands each, which I think is clearer and easier for new users to process.

As discussed at the GitTogether.
Signed-off-by: Scott Chacon <schacon@gmail.com>
---

This makes the 'git' (with no arguments) command look like this: http://gist.github.com/20553

This won't automatically update with the common-commands.txt file, but I think it is easier to parse for the command you may be looking for.

 builtin-help.c |   42 +++++++++++++++++++++++++++++-------------
 1 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/builtin-help.c b/builtin-help.c
index f076efa..562d5d1 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -277,19 +277,35 @@ static struct cmdnames main_cmds, other_cmds;
 
 void list_common_cmds_help(void)
 {
-	int i, longest = 0;
-
-	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-		if (longest < strlen(common_cmds[i].name))
-			longest = strlen(common_cmds[i].name);
-	}
-
-	puts("The most commonly used git commands are:");
-	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-		printf("   %s   ", common_cmds[i].name);
-		mput_char(' ', longest - strlen(common_cmds[i].name));
-		puts(common_cmds[i].help);
-	}
+	puts("The most commonly used git commands are:\n\
+\n\
+Basic Commands\n\
+  init       Create an empty git repository or reinitialize an existing one\n\
+  add        Add file contents to the staging area\n\
+  status     Show the working tree and staging area status\n\
+  commit     Record changes in the staging area to the repository\n\
+  rm         Remove files from the working tree and from the index\n\
+  mv         Move or rename a file, a directory, or a symlink\n\
+\n\
+History Commands\n\
+  log        Show commit log history\n\
+  diff       Show changes between commits, commit and working tree, etc\n\
+  grep       Print lines in git tracked files matching a pattern\n\
+  reset      Reset current HEAD to the specified state\n\
+  show       Show various types of objects\n\
+\n\
+Branch Commands\n\
+  checkout   Checkout a branch or paths to the working tree\n\
+  branch     List, create, or delete branches\n\
+  merge      Join two or more development histories together\n\
+  rebase     Apply changes introduced in one branch onto another\n\
+  tag        Create, list, delete or verify a tag object signed with GPG\n\
+\n\
+Remote Commands\n\
+  clone      Clone a repository into a new directory\n\
+  fetch      Download objects and refs from another repository\n\
+  pull       Fetch from and merge with another repository or a local branch\n\
+  push       Update remote refs along with associated objects");
 }
 
 static int is_git_command(const char *s)
-- 
1.6.0.8.gc9c8
Next: Jeff King
Message 1 of 12 in “Modified the default git help message to be grouped by topic”
  1. Modified the default git help message to be grouped by topicScott Chacon, Dec 1, 2008
  2. Jeff KingDec 1, 2008
  3. Junio C HamanoDec 2, 2008
  4. Scott ChaconDec 2, 2008
  5. James PickensDec 2, 2008
  6. Boyd Stephen Smith Jr.Dec 2, 2008
  7. Johannes SchindelinDec 2, 2008
  8. Jeff KingDec 2, 2008
  9. Scott ChaconDec 2, 2008
  10. Junio C HamanoDec 3, 2008
  11. Jeff KingDec 3, 2008
  12. Jakub NarebskiDec 3, 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.