10

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
  • 28,558
  • 6
  • 66
  • 126
davidlee
  • 3,294
  • 13
  • 47
  • 78
  • 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

20

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
  • 3,828
  • 4
  • 26
  • 46