How to zip up a git project without the .git files

Once in awhile (like today!) I have to zip up a git project to send to someone.

When this happens, obviously don't want to include the .git files, I just want the contents of the repo.

To do this, I use this command:

zip -r my-zippedup-stuff.zip ./directory-of-my-project/ -x '*.git*'

To break this down:

  1. zip - the command I'm running
  2. -r - do this recursively
  3. my-zippedup-stuff.zip - the name of the zip file I want to create
  4. ./directory-of-my-project/ - the name of a directory BELOW my current location
  5. -x '*.git*' - ignore all files ending with anything starting with .git