@matheusbsbs / matheus-bagliano / commits / 67e78c3b8a
Fork 0

Added bash completion support for git-reset.

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> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Nov 4, 2006 at 13:57 UTC 67e78c3b8aeb44681b2d4ab2cf97145b7cc9a7a2
1 file changed +9
contrib/completion/git-completion.bash
+9
@@ -271,6 +271,13 @@ _git_push ()
271 esac
272 }
273
274 +_git_reset ()
275 +{
276 + local cur="${COMP_WORDS[COMP_CWORD]}"
277 + local opt="--mixed --hard --soft"
278 + COMPREPLY=($(compgen -W "$opt $(__git_refs .)" -- "$cur"))
279 +}
280 +
281 _git_show ()
282 {
283 local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -304,6 +311,7 @@ _git ()
311 ls-tree) _git_ls_tree ;;
312 pull) _git_pull ;;
313 push) _git_push ;;
314 + reset) _git_reset ;;
315 show) _git_show ;;
316 show-branch) _git_log ;;
317 whatchanged) _git_log ;;
@@ -332,6 +340,7 @@ complete -o default -o nospace -F _git_ls_tree git-ls-tree
340 complete -o default -F _git_merge_base git-merge-base
341 complete -o default -o nospace -F _git_pull git-pull
342 complete -o default -o nospace -F _git_push git-push
343 +complete -o default -F _git_reset git-reset
344 complete -o default -F _git_show git-show
345 complete -o default -o nospace -F _git_log git-whatchanged
346