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

[PATCH v2] completion: complete "git -<TAB>" with short options

From
WGWiktor Mis via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 26, 2025, 16:26 UTC
Message-ID
<pull.2100.v2.git.git.1764174391776.gitgitgadget@gmail.com>
In-Reply-To
<pull.2100.git.git.1764052739534.gitgitgadget@gmail.com>
From: Wiktor Mis <mwiktor023@gmail.com>
"git" itself has completion for long options and cmds, but not short ones
Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
---
    Add completion for short options
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2100%2FWiktorro%2Fpatch-3-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2100/Wiktorro/patch-3-v2
Pull-Request: https://github.com/git/git/pull/2100
Range-diff vs v1:
 1:  1b15a0b458 ! 1:  e6161ffe3b Add completion for short options
     @@ Metadata
      Author: Wiktor Mis <mwiktor023@gmail.com>
      
       ## Commit message ##
     -    Add completion for short options
     +    completion: complete "git -<TAB>" with short options
      
     -    Git provided completion for long options but not the short ones
     +    "git" itself has completion for long options and cmds, but not short ones
      
          Signed-off-by: Wiktor Mis <mwiktor023@gmail.com>
      
       ## contrib/completion/git-completion.bash ##
      @@ contrib/completion/git-completion.bash: __git_main ()
     - 			--help
     - 			"
       			;;
     + 		esac
     + 		case "$cur" in
     +-		--*)
      +		-*)
     -+			__gitcomp "
     + 			__gitcomp "
     + 			--paginate
     + 			--no-pager
     +@@ contrib/completion/git-completion.bash: __git_main ()
     + 			--namespace=
     + 			--no-replace-objects
     + 			--help
      +			-C
      +			-P
      +			-c
      +			-h
      +			-p
      +			-v
     -+			"
     -+			;;
     + 			"
     + 			;;
       		*)
     - 			if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}"
     - 			then
 contrib/completion/git-completion.bash | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 73abea31b4..1705ca3323 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3898,7 +3898,7 @@ __git_main ()
 			;;
 		esac
 		case "$cur" in
-		--*)
+		-*)
 			__gitcomp "
 			--paginate
 			--no-pager
@@ -3914,6 +3914,12 @@ __git_main ()
 			--namespace=
 			--no-replace-objects
 			--help
+			-C
+			-P
+			-c
+			-h
+			-p
+			-v
 			"
 			;;
 		*)

base-commit: fd372d9b1a69a01a676398882bbe3840bf51fe72
-- 
gitgitgadget
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 7 in “Add completion for short options”
  1. Add completion for short optionsWiktor Mis via GitGitGadget, Nov 25, 2025
  2. Junio C HamanoNov 25, 2025
  3. completion: complete "git -<TAB>" with short optionsWiktor Mis via GitGitGadget, Nov 26, 2025
  4. Junio C HamanoNov 26, 2025
  5. SZEDER GáborNov 27, 2025
  6. Junio C HamanoNov 27, 2025
  7. Junio C HamanoDec 7, 2025

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.