1

Is there a command a way or a script that can let me export all the ignored git directories and files in my .gitignore file to a folder of my choice preserving the directory structure?

I can get the whole list using this command:

git ls-files -i --exclude-from=[PATH_TO_GITIGNORE_FILE] -o

But I wasn't able to figure out how to do a mass export on a folder of my choice.

S.Magnaschi
  • 787
  • 5
  • 12
  • This lists files that are marked for exclusion, but are included anyway. For example, I generate a bunch of `.png`s, and have `*.png` in my `.gitignore`, but a selected few `.png` *are* under git's control, not generated. This command lists those only. – vonbrand Feb 26 '14 at 15:00

1 Answers1

3

You can of course use tar. Since you generate the list of files already, see this question: How can I build a tar from stdin? on constructing an archive from the file list.

Community
  • 1
  • 1
mockinterface
  • 14,452
  • 5
  • 28
  • 49
  • Thanks! For the sake of completeness here is the command: `git ls-files -i --exclude-from=[PATH_TO_GITIGNORE_FILE] -o | tar cfz PATH_TO_TGZ -T -` – S.Magnaschi Feb 26 '14 at 12:45