Assuming we are sitting in the package development git repo, this command will create a tarball one directory up. Replace branch with the name of the branch you wish to archive.
git archive --format=tar --prefix=package-6.2.0/ <branch> | bzip2 > ../package-6.2.0.tar.bz2
This works great for me as I use .tar.bz2 files in my rpm spec files to build final rpm packages to deploy.
If you need gzip instead of bzip2, pipe the git archive command into gzip
instead. And, of course, update the output filename accordingly.