Tarballing without Git metadata

Solution 1:

You will get a nasty surprise when the number of files increase to more than one xargs command: Then you will first make a tar file of the first files and then overwrite the same tar file with the rest of the files.

GNU tar has the --exclude option which will solve this issue:

tar cvf ~/app.tar --exclude .git --exclude "*.log" .

Solution 2:

You can try directly with the tar option --exclude-vcs:

--exclude-vcs:
          Exclude version control system directories

For example:

tar cvfj nameoffile.tar.bz2 directory/ --exclude-vcs

It works with Git.

Solution 3:

Try something like this:

git archive --format=tar -o ~/tarball.tar -v HEAD

Add your .log files and everything else you don't want to be packed to your .gitignore file.