Add all files using git add except one directory

If your Git version is new enough,

git add -- . ':!<path>'

. means all under the current directory, and ':!<path>' means to exclude the path. So it means to add all except path.

The term for . ':!<path>' is pathspec. However, the doc is a bit obscure and lack of abundant examples. I find this post very helpful to understand pathspec.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)