How to add multiple files in git
11,517
Solution 1
git add .
git commit -m "message"
git push
Solution 2
Update
Yes in that case you can simply use git add .
. You can check which files have been modified by using git status
. If only your three files are being displayed, a simple git add .
is enough, afterwards use git push
.
Solution 3
1) You can add only the three modified files with:
git add file1 file2 file3
2) OR You can add all the files with
git add .
3) OR If they are all of the same type and say, the fourth one has a different extension, then you can also add the three files using:
git add *.js //example for files with Javascript .js extension
Then do : git commit -m "message"
and then a : git push
Author by
Stacy J
Updated on June 04, 2022Comments
-
Stacy J almost 2 years
I have 4 files in a folder. I have modified 3 of them. How do I add and push only the modified files all at once. Will "git add ." work here.
-
Daniel Hilgarth about 11 yearsHave you tried it? What was the result?
-
NilsH about 11 yearsNot an answer to your question, but you can also use 'git add -i' to get an interactive shell where you can stage/unstage files
-
-
Daniel Hilgarth about 11 yearsAs the fourth file didn't change,
git add .
is exactly what he wants. -
Tuxdude about 11 yearsBTW, it ain't a regex, it is a glob pattern. ;)