14

May I know how to stage all the files in a folder like a folder called subfolder on git?

Have tried

git add subfolder/\\*

but doesn't work.

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
davidlee
  • 5,611
  • 17
  • 56
  • 82
  • Possible duplicate of [Git add all subdirectories](http://stackoverflow.com/questions/14620863/git-add-all-subdirectories) – Chris Maes Jan 22 '16 at 10:49

1 Answers1

30

Just use git add subfolder.

I usually use git add . in the root of the repository to stage all files in the repo.

If you want to use the asterisk, you should use git add subfolder/* because the shell will expand this into git add subfolder/foo subfolder/bar subfolder/... with all the files in the directory.

When using git add subfolder/\\*, the shell won't expand the asterisk, which will cause it to call git add subfolder/* which tries to add a file called * in the subfolder.

das_j
  • 4,444
  • 5
  • 31
  • 47