Question: This is breaking 

```
alias f='git flow feature'
complete -F __git_flow_feature f

```

It works eventually (after 2 'tabs') but throws an error on each 'tab' press. 

```
-bash: [: 1: unary operator expected

```

Any ideas?

Answer: 
I had this problem too and every Google search lead me back to this post.

I am posting the solution I found using Michal's answer and Daenyth's comment...

My git-flow.bash was identical, but I think our git completion files might be varying.

To fix this I had to modify my git completion file located at `/etc/bash_completion.d/git`

Old:

```
# __git_find_on_cmdline requires 1 argument
__git_find_on_cmdline ()
{
local word subcommand c=1
while [ $c -lt $cword ]; do
    word="${words[c]}"
    for subcommand in $1; do
        if [ "$subcommand" = "$word" ]; then
            echo "$subcommand"
            return
        fi
    done
    c=$((++c))
done
}

```

New:

```
# __git_find_on_cmdline requires 1 argument
__git_find_on_cmdline ()
{
local word subcommand c=1
while [[ $c -lt $cword ]]; do
    word="${words[c]}"
    for subcommand in $1; do
        if [ "$subcommand" = "$word" ]; then
            echo "$subcommand"
            return
        fi
    done
    c=$((++c))
done
}

```

Notice the double bracket I had to add to the new code. That was the only change I made.
I have this aliases:

```
alias gn="git-number"
alias gb="gn -c git blame"
alias ge="gn -c $EDITOR"
alias ga="gn add"
alias gr="gn -c git reset"
alias gap="EDITOR='$EDITOR -w' gn add -p"
alias gd="gn -c git diff -b -w --ignore-blank-lines"
alias gds="gd --staged"
alias gc="gn -c git checkout"
alias gcf="git flow feature checkout"
alias gl="gn -c git log -w -b -p --ignore-blank-lines"
alias gls="git log --stat"
alias cm="EDITOR='$EDITOR -w' git commit"
alias grb="git stash save 'REBASE' && EDITOR='$EDITOR -w' git rebase -i"
alias grbc="EDITOR='$EDITOR -w' git rebase --continue"

gcd() {
    test -n "$1" && cd $(dirname $(git list $1))
}

source ~/.git-completion.bash
__git_complete gn  _git
__git_complete ga  _git_add
__git_complete gap _git_add
__git_complete gd  _git_diff
__git_complete gds _git_diff
__git_complete gc  _git_checkout
__git_complete gcf _git_checkout
__git_complete gl  _git_log
__git_complete gls _git_log
__git_complete cm  _git_commit

source ~/.git-flow-completion.bash

```

And install `completion` scripts as:

```
wget -O ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
wget -O ~/.git-flow-completion.bash https://raw.githubusercontent.com/petervanderdoes/git-flow-completion/develop/git-flow-completion.bash    

```

Git number noted here is: <https://github.com/holygeek/git-number>
Just copy binaries at repo to `~/bin`