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

[PATCH 2/2] Added bash completion support for git-reset.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Nov 4, 2006, 18:57 UTC
Message-ID
<20061104185744.GB2500@spearce.org>

Completion for the --hard/--soft/--mixed modes of operation as well as a ref name for <commit-ish> can be very useful and save some fingers.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 contrib/completion/git-completion.bash |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b7b8a43..a3fbb90 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -271,6 +271,13 @@ _git_push ()
 	esac
 }
 
+_git_reset ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	local opt="--mixed --hard --soft"
+	COMPREPLY=($(compgen -W "$opt $(__git_refs .)" -- "$cur"))
+}
+
 _git_show ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -304,6 +311,7 @@ _git ()
 		ls-tree)     _git_ls_tree ;;
 		pull)        _git_pull ;;
 		push)        _git_push ;;
+		reset)       _git_reset ;;
 		show)        _git_show ;;
 		show-branch) _git_log ;;
 		whatchanged) _git_log ;;
@@ -332,6 +340,7 @@ complete -o default -o nospace -F _git_l
 complete -o default            -F _git_merge_base git-merge-base
 complete -o default -o nospace -F _git_pull git-pull
 complete -o default -o nospace -F _git_push git-push
+complete -o default            -F _git_reset git-reset
 complete -o default            -F _git_show git-show
 complete -o default -o nospace -F _git_log git-whatchanged
 
Message 1 of 1 in “Added bash completion support for git-reset.”
  1. 2/2 Added bash completion support for git-reset.Shawn O. Pearce, Nov 4, 2006

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.