docker: use GIT_DIR and patch.
docker: cleanup completions.
brew: check for --help and friends in more of ARGV

Let's check for e.g. --help anywhere in the ARGV array rather than just
the first value to avoid brew upgrade --help causing problems.

Closes #26675.