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.
Asked
Active
Viewed 1.3k times
4 Answers
7
git add .
git commit -m "message"
git push

Tadeusz A. Kadłubowski
- 8,047
- 1
- 30
- 37

Stuart M
- 11,458
- 6
- 45
- 59
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

learner_19
- 3,851
- 1
- 19
- 8
1
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
.

Manuel
- 3,828
- 6
- 33
- 48
-
As the fourth file *didn't* change, `git add .` is *exactly* what he wants. – Daniel Hilgarth Mar 21 '13 at 08:40
-