Vim - Prevent NERDTree opening when invoked by git
I think you already have all the pieces together: Just combine the launch of NERDTree with a conditional on the filetype; when VimEnter
fires, this should already be set:
:autocmd VimEnter * if &filetype !=# 'gitcommit' | NERDTree | endif