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

Re: If you would write git from scratch now, what would you change?

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 27, 2007, 03:35 UTC
Message-ID
<7v7ik4e4xa.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20071127010350.GE14735@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 34 quoted lines
> Junio C Hamano <gitster@pobox.com> wrote:
>> Wincent Colaiuta <win@wincent.com> writes:
>> >
>> > $ git-<tab>
>> > Display all 146 possibilities? (y or n)
>> 
>> The tab completion for bash and zsh would also help you here, but I see
>> there are quite a few commands that should not be there, and it's time
>> to clean it up.
> ...
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index cad842a..1bba68b 100755
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -359,6 +359,15 @@ __git_commands ()
>>  		upload-pack)      : plumbing;;
>>  		write-tree)       : plumbing;;
>>  		verify-tag)       : plumbing;;
>> +		annotate)         : use blame;;
>> +		checkout-index)   : plumbing;;
>> +		diff-stages)      : plumbing;;
>> +		get-tar-commit-id) : plumbing;;
>> +		lost-found)       : deprecated;;
>> +		rebase--interactive) : plumbing;;
>> +		relink)           : obsolete;;
>> +		whatchanged)      : plumbing;;
>> +		verify-pack)      : plumbing;;
>>  		*) echo $i;;
>>  		esac
>>  	done
>
> Ack'd-by: Shawn O. Pearce <spearce@spearce.org>
>
> ;-)

Seriously, speaking I find this "negative" list ugly. I am wondering if it makes more sense to use positive "Porcelain" list, or perhaps even "The most commonly used" list from "git help" output.

Here is an alternate attempt to it.
---
 Documentation/cmd-list.perl            |   59 ++++++++++++------------
 Makefile                               |    2 +-
 contrib/completion/git-completion.bash |   77 ++------------------------------
 generate-cmdlist.sh                    |   34 ++------------
 4 files changed, 40 insertions(+), 132 deletions(-)
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index b709551..a966b5e 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -26,10 +26,11 @@ sub format_one {
 	if (!defined $description) {
 		die "No description found in $name.txt";
 	}
+
 	if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
 		print $out "gitlink:$name\[1\]::\n\t";
-		if ($attr) {
-			print $out "($attr) ";
+		if ($attr =~ /deprecated/) {
+			print $out "(deprecated) ";
 		}
 		print $out "$text.\n\n";
 	}
@@ -75,27 +76,27 @@ for my $cat (qw(ancillaryinterrogators
 # The following list is sorted with "sort -d" to make it easier
 # to find entry in the resulting git.html manual page.
 __DATA__
-git-add                                 mainporcelain
+git-add                                 mainporcelain common
 git-am                                  mainporcelain
 git-annotate                            ancillaryinterrogators
-git-apply                               plumbingmanipulators
+git-apply                               plumbingmanipulators common
 git-archimport                          foreignscminterface
-git-archive                             mainporcelain
-git-bisect                              mainporcelain
+git-archive                             mainporcelain common
+git-bisect                              mainporcelain common
 git-blame                               ancillaryinterrogators
-git-branch                              mainporcelain
+git-branch                              mainporcelain common
 git-bundle                              mainporcelain
 git-cat-file                            plumbinginterrogators
 git-check-attr                          purehelpers
-git-checkout                            mainporcelain
+git-checkout                            mainporcelain common
 git-checkout-index                      plumbingmanipulators
 git-check-ref-format                    purehelpers
 git-cherry                              ancillaryinterrogators
-git-cherry-pick                         mainporcelain
+git-cherry-pick                         mainporcelain common
 git-citool                              mainporcelain
 git-clean                               mainporcelain
-git-clone                               mainporcelain
-git-commit                              mainporcelain
+git-clone                               mainporcelain common
+git-commit                              mainporcelain common
 git-commit-tree                         plumbingmanipulators
 git-config                              ancillarymanipulators
 git-count-objects                       ancillaryinterrogators
@@ -104,12 +105,12 @@ git-cvsimport                           foreignscminterface
 git-cvsserver                           foreignscminterface
 git-daemon                              synchingrepositories
 git-describe                            mainporcelain
-git-diff                                mainporcelain
+git-diff                                mainporcelain common
 git-diff-files                          plumbinginterrogators
 git-diff-index                          plumbinginterrogators
 git-diff-tree                           plumbinginterrogators
 git-fast-import				ancillarymanipulators
-git-fetch                               mainporcelain
+git-fetch                               mainporcelain common
 git-fetch-pack                          synchingrepositories
 git-filter-branch                       ancillarymanipulators
 git-fmt-merge-msg                       purehelpers
@@ -118,24 +119,24 @@ git-format-patch                        mainporcelain
 git-fsck	                        ancillaryinterrogators
 git-gc                                  mainporcelain
 git-get-tar-commit-id                   ancillaryinterrogators
-git-grep                                mainporcelain
+git-grep                                mainporcelain common
 git-gui                                 mainporcelain
 git-hash-object                         plumbingmanipulators
 git-http-fetch                          synchelpers
 git-http-push                           synchelpers
 git-imap-send                           foreignscminterface
 git-index-pack                          plumbingmanipulators
-git-init                                mainporcelain
+git-init                                mainporcelain common
 git-instaweb                            ancillaryinterrogators
 gitk                                    mainporcelain
-git-log                                 mainporcelain
+git-log                                 mainporcelain common
 git-lost-found                          ancillarymanipulators	deprecated
 git-ls-files                            plumbinginterrogators
 git-ls-remote                           plumbinginterrogators
 git-ls-tree                             plumbinginterrogators
 git-mailinfo                            purehelpers
 git-mailsplit                           purehelpers
-git-merge                               mainporcelain
+git-merge                               mainporcelain common
 git-merge-base                          plumbinginterrogators
 git-merge-file                          plumbingmanipulators
 git-merge-index                         plumbingmanipulators
@@ -144,7 +145,7 @@ git-mergetool                           ancillarymanipulators
 git-merge-tree                          ancillaryinterrogators
 git-mktag                               plumbingmanipulators
 git-mktree                              plumbingmanipulators
-git-mv                                  mainporcelain
+git-mv                                  mainporcelain common
 git-name-rev                            plumbinginterrogators
 git-pack-objects                        plumbingmanipulators
 git-pack-redundant                      plumbinginterrogators
@@ -152,13 +153,13 @@ git-pack-refs                           ancillarymanipulators
 git-parse-remote                        synchelpers
 git-patch-id                            purehelpers
 git-peek-remote                         purehelpers	deprecated
-git-prune                               ancillarymanipulators
+git-prune                               ancillarymanipulators common
 git-prune-packed                        plumbingmanipulators
-git-pull                                mainporcelain
-git-push                                mainporcelain
+git-pull                                mainporcelain common
+git-push                                mainporcelain common
 git-quiltimport                         foreignscminterface
 git-read-tree                           plumbingmanipulators
-git-rebase                              mainporcelain
+git-rebase                              mainporcelain common
 git-receive-pack                        synchelpers
 git-reflog                              ancillarymanipulators
 git-relink                              ancillarymanipulators
@@ -166,28 +167,28 @@ git-remote                              ancillarymanipulators
 git-repack                              ancillarymanipulators
 git-request-pull                        foreignscminterface
 git-rerere                              ancillaryinterrogators
-git-reset                               mainporcelain
-git-revert                              mainporcelain
+git-reset                               mainporcelain common
+git-revert                              mainporcelain common
 git-rev-list                            plumbinginterrogators
 git-rev-parse                           ancillaryinterrogators
-git-rm                                  mainporcelain
+git-rm                                  mainporcelain common
 git-runstatus                           ancillaryinterrogators
 git-send-email                          foreignscminterface
 git-send-pack                           synchingrepositories
 git-shell                               synchelpers
 git-shortlog                            mainporcelain
-git-show                                mainporcelain
-git-show-branch                         ancillaryinterrogators
+git-show                                mainporcelain common
+git-show-branch                         ancillaryinterrogators common
 git-show-index                          plumbinginterrogators
 git-show-ref                            plumbinginterrogators
 git-sh-setup                            purehelpers
 git-stash                               mainporcelain
-git-status                              mainporcelain
+git-status                              mainporcelain common
 git-stripspace                          purehelpers
 git-submodule                           mainporcelain
 git-svn                                 foreignscminterface
 git-symbolic-ref                        plumbingmanipulators
-git-tag                                 mainporcelain
+git-tag                                 mainporcelain common
 git-tar-tree                            plumbinginterrogators	deprecated
 git-unpack-file                         plumbinginterrogators
 git-unpack-objects                      plumbingmanipulators
diff --git a/Makefile b/Makefile
index ccf522a..ca1c2f5 100644
--- a/Makefile
+++ b/Makefile
@@ -804,7 +804,7 @@ git-merge-subtree$X: git-merge-recursive$X
 $(BUILT_INS): git$X
 	$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
 
-common-cmds.h: ./generate-cmdlist.sh
+common-cmds.h: ./generate-cmdlist.sh Documentation/cmd-list.perl
 
 common-cmds.h: $(wildcard Documentation/git-*.txt)
 	$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 599b2fc..d54b415 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -287,79 +287,10 @@ __git_commands ()
 		echo "$__git_commandlist"
 		return
 	fi
-	local i IFS=" "$'\n'
-	for i in $(git help -a|egrep '^ ')
-	do
-		case $i in
-		add--interactive) : plumbing;;
-		applymbox)        : ask gittus;;
-		applypatch)       : ask gittus;;
-		archimport)       : import;;
-		cat-file)         : plumbing;;
-		check-attr)       : plumbing;;
-		check-ref-format) : plumbing;;
-		commit-tree)      : plumbing;;
-		cvsexportcommit)  : export;;
-		cvsimport)        : import;;
-		cvsserver)        : daemon;;
-		daemon)           : daemon;;
-		diff-files)       : plumbing;;
-		diff-index)       : plumbing;;
-		diff-tree)        : plumbing;;
-		fast-import)      : import;;
-		fsck-objects)     : plumbing;;
-		fetch--tool)      : plumbing;;
-		fetch-pack)       : plumbing;;
-		fmt-merge-msg)    : plumbing;;
-		for-each-ref)     : plumbing;;
-		hash-object)      : plumbing;;
-		http-*)           : transport;;
-		index-pack)       : plumbing;;
-		init-db)          : deprecated;;
-		local-fetch)      : plumbing;;
-		mailinfo)         : plumbing;;
-		mailsplit)        : plumbing;;
-		merge-*)          : plumbing;;
-		mktree)           : plumbing;;
-		mktag)            : plumbing;;
-		pack-objects)     : plumbing;;
-		pack-redundant)   : plumbing;;
-		pack-refs)        : plumbing;;
-		parse-remote)     : plumbing;;
-		patch-id)         : plumbing;;
-		peek-remote)      : plumbing;;
-		prune)            : plumbing;;
-		prune-packed)     : plumbing;;
-		quiltimport)      : import;;
-		read-tree)        : plumbing;;
-		receive-pack)     : plumbing;;
-		reflog)           : plumbing;;
-		repo-config)      : plumbing;;
-		rerere)           : plumbing;;
-		rev-list)         : plumbing;;
-		rev-parse)        : plumbing;;
-		runstatus)        : plumbing;;
-		sh-setup)         : internal;;
-		shell)            : daemon;;
-		send-pack)        : plumbing;;
-		show-index)       : plumbing;;
-		ssh-*)            : transport;;
-		stripspace)       : plumbing;;
-		svn)              : import export;;
-		symbolic-ref)     : plumbing;;
-		tar-tree)         : deprecated;;
-		unpack-file)      : plumbing;;
-		unpack-objects)   : plumbing;;
-		update-index)     : plumbing;;
-		update-ref)       : plumbing;;
-		update-server-info) : daemon;;
-		upload-archive)   : plumbing;;
-		upload-pack)      : plumbing;;
-		write-tree)       : plumbing;;
-		verify-tag)       : plumbing;;
-		*) echo $i;;
-		esac
-	done
+	git help | sed -e '
+		1,/^The most commonly used git/d
+		s/^ *\([^ ][^ ]*\)[ ].*/\1/
+	'
 }
 __git_commandlist=
 __git_commandlist="$(__git_commands 2>/dev/null)"
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 17df47b..28f9749 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -9,35 +9,11 @@ struct cmdname_help
 
 static struct cmdname_help common_cmds[] = {"
 
-sort <<\EOF |
-add
-apply
-archive
-bisect
-branch
-checkout
-cherry-pick
-clone
-commit
-diff
-fetch
-grep
-init
-log
-merge
-mv
-prune
-pull
-push
-rebase
-reset
-revert
-rm
-show
-show-branch
-status
-tag
-EOF
+sed -n -e '
+	1,/__DATA__/d
+	s/^git-\([^ 	]*\)[ 	].*[ 	]common/\1/p
+' Documentation/cmd-list.perl |
+sort |
 while read cmd
 do
      sed -n '
Previous: Shawn O. PearceNext: Steven Grimm
Message 58 of 83 in “If you would write git from scratch now, what would you change?”
  1. Jakub NarebskiNov 25, 2007
  2. Pierre HabouzitNov 25, 2007
  3. Steven WalterNov 26, 2007
  4. Junio C HamanoNov 26, 2007
  5. Adam RobenNov 26, 2007
  6. Carlos RicaNov 26, 2007
  7. Daniel BarkalowNov 26, 2007
  8. Andy ParkinsNov 26, 2007
  9. Benoit SigoureNov 26, 2007
  10. Jan HudecNov 26, 2007
  11. David KastrupNov 26, 2007
  12. Jan HudecNov 26, 2007
  13. Michael PooleNov 26, 2007
  14. Jan HudecNov 26, 2007
  15. Michael PooleNov 26, 2007
  16. Jon SmirlNov 26, 2007
  17. Andy ParkinsNov 26, 2007
  18. Marco CostalbaNov 26, 2007
  19. Shawn O. PearceNov 27, 2007
  20. Jakub NarebskiNov 27, 2007
  21. Shawn O. PearceNov 27, 2007
  22. Johannes SchindelinNov 27, 2007
  23. [RFC] git-gui USer's Survey 2007 (was: If you would write git from scratch now, what would you change?)Jakub Narebski, Nov 27, 2007
  24. Johannes SchindelinNov 28, 2007
  25. Jason SewallNov 28, 2007
  26. Jan HudecNov 28, 2007
  27. Johannes SchindelinNov 28, 2007
  28. Jan HudecNov 29, 2007
  29. Johannes SchindelinNov 29, 2007
  30. Jan HudecNov 30, 2007
  31. Marco CostalbaNov 30, 2007
  32. Shawn O. PearceDec 1, 2007
  33. Marco CostalbaDec 1, 2007
  34. Sergei OrganovNov 28, 2007
  35. Andy ParkinsNov 27, 2007
  36. Marco CostalbaNov 27, 2007
  37. Jan HudecNov 27, 2007
  38. Johannes SchindelinNov 27, 2007
  39. Andy ParkinsDec 4, 2007
  40. Jing XueNov 27, 2007
  41. Jon SmirlNov 26, 2007
  42. David KastrupNov 26, 2007
  43. Jan HudecNov 26, 2007
  44. Benoit SigoureNov 26, 2007
  45. Jan HudecNov 26, 2007
  46. Nicolas PitreNov 26, 2007
  47. David KastrupNov 26, 2007
  48. Jan HudecNov 26, 2007
  49. David KastrupNov 26, 2007
  50. Jan HudecNov 26, 2007
  51. Nicolas PitreNov 26, 2007
  52. Wincent ColaiutaNov 26, 2007
  53. Junio C HamanoNov 26, 2007
  54. Nicolas PitreNov 26, 2007
  55. Junio C HamanoNov 26, 2007
  56. Nicolas PitreNov 26, 2007
  57. Shawn O. PearceNov 27, 2007
  58. Junio C HamanoNov 27, 2007
  59. Steven GrimmNov 27, 2007
  60. Johannes SchindelinNov 26, 2007
  61. Nicolas PitreNov 26, 2007
  62. Johannes SchindelinNov 26, 2007
  63. Andreas EricssonNov 27, 2007
  64. Jakub NarebskiNov 27, 2007
  65. Dana HowNov 26, 2007
  66. Nicolas PitreNov 26, 2007
  67. Dana HowNov 26, 2007
  68. Nicolas PitreNov 26, 2007
  69. Dana HowNov 26, 2007
  70. Nicolas PitreNov 26, 2007
  71. Jakub NarebskiNov 26, 2007
  72. Dana HowNov 26, 2007
  73. Shawn O. PearceNov 27, 2007
  74. Nicolas PitreNov 27, 2007
  75. Shawn O. PearceNov 27, 2007
  76. Junio C HamanoNov 27, 2007
  77. Shawn O. PearceNov 27, 2007
  78. Jakub NarebskiNov 27, 2007
  79. C# binding, was Re: If you would write git from scratch now, what would you change?Johannes Schindelin, Nov 27, 2007
  80. Nicolas PitreNov 27, 2007
  81. Dana HowNov 27, 2007
  82. Shawn O. PearceNov 27, 2007
  83. Linus TorvaldsNov 27, 2007

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.