2

I have a situation wherein I have to take a huge list of un-tracked file and copy it to some backup folder.

I know we can stash un-tracked file using git stash -u but I don't want that.

I just want it to be copied to local folder in filesystem.

Is that possible ?

ART
  • 1,509
  • 3
  • 29
  • 47

1 Answers1

3

You can list files that are untracked (and not ignored)

git ls-files --others --exclude-standard

From there, you can copy each one to a backup location.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you for reply. `git ls-files --others --exclude-standard | xargs tar cvzf backup.tar.gz` I could tar them and put it to another folder. But somehow cp copies only files and not a folder structure. Anyways tar works as well. – ART Oct 29 '15 at 07:58