If I tar a folder that is a git repository, can I do so without including the
.git related files? If not, how would I go about doing that via a command?
Have a look first at
If you want the archive to include the files tracked by git, but not the git repository itself or any generated or otherwise untracked file, then use
If you specifically want to exclude
With GNU tar (i.e. under Linux or Cygwin), you can shorten this to
The POSIX way of creating archives is
Simplest answer: Add
This excludes all version control system directories
Personally I use
so all you need to do is add the --exclude-vcs at the end of the command.