# Re: Bash completion suggests tags for git branch -D

- From: SZEDER Gábor \<hidden\>
- Date: 2021-02-03 20:01:35 
- List: git
- Page: https://ratatoskr.run/git/2021/02/7875031
- Thread: https://ratatoskr.run/git/2021/02/7874888/t.md

```text
On Tue, Feb 02, 2021 at 09:14:39AM -0800, Junio C Hamano wrote:
> From: Jeff King <redacted>
> Date: Tue Feb 2 04:02:13 2021 -0500
> Subject: [PATCH] completion: treat "branch -D" the same way as "branch -d"
> 
> Paul Jolly noticed that the former offers not just branches but tags
> as completion candidates.  Mimic how "branch -d" limits its suggestion
> to branch names.

Uh-oh.  This is a bug from my second ever commit in Git! ;)

'-M' should be handled the same.

> Signed-off-by: Jeff King <redacted>
> Signed-off-by: Junio C Hamano <redacted>
> ---
>  contrib/completion/git-completion.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 4b1f4264a6..b54113e2f9 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1447,7 +1447,7 @@ _git_branch ()
>  	while [ $c -lt $cword ]; do
>  		i="${words[c]}"
>  		case "$i" in
> -		-d|--delete|-m|--move)	only_local_ref="y" ;;
> +		-d|--delete|-D|-m|--move)	only_local_ref="y" ;;
>  		-r|--remotes)		has_r="y" ;;
>  		esac
>  		((c++))
> -- 
> 2.30.0-586-g047f30a795
> 
```
