Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stage all files in if a subfolder on git

Tags:

git

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.

like image 269
davidlee Avatar asked Jan 22 '16 09:01

davidlee


1 Answers

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.

like image 181
das_j Avatar answered Sep 25 '22 14:09

das_j