Search code examples
wordpressgitarchive

Git Archive but first put all the files inside a folder then start archiving


As title suggest, I want to know if there is a single git command that put all my project in one folder first (not including .gitignored files) and then proceed archiving the folder— leaving ignored files not included when archiving which is nice.

This can be beneficial for me as I am working on WordPress plugin with multiple release. Some references.


Solution

  • I want all the files (minus the .gitignored files) move to a folder first then proceed archiving that folder

    It is possible in one command provided you define an alias but this isn't git-related:
    you can:

    • clone your repo elsewhere (that way you don't get any ignored or private file)
    • move your files as you see fit in that local clone
    • archive (tar cpvf yourArchive.tar yourFolder)

    But git archive alone won't help you move those files, which is why I would recommend a script with custom bash commands (not git commands).