my project directory structure is like this:
my_project/
.git/
a_dir/
another_file.py
some_file.py
when I run git archive link this:
git archive --format=tar.gz -o ../my_project-0.1.0.tar.gz v0.1.0
it archives the contents of my_project, but not the my_project directory. When I untar the archive, by default all of the directories and files are extracted in the current working directory. I want my archive to expand to a subdirectory called my_project-0.1.0. Can I do this on the git command line? Did I set up my repository wrong?
Use
--prefix. From the docs:Thus you can do:
The trailing
/is important.