How to add multiple files to Git at the same time

kishore . picture kishore . · Oct 24, 2013 · Viewed 236.2k times · Source

This will be my first git use. I have added new files ( a lot ) to the folder/project ( git local repository).

I went through online tutorials and forums and see i can do

git commit -a

So I go to the base folder of the repository and do a

sudo git commit -a

But then, some screens comes up and asks me to add a comment which i do. i do not know how to proceed or exit. I do not want to mess up so i did ctrl + Z and did not do anything.

Can you guys please outline the commands I need to use?

git commit -a 

and

git push?

Answer

Reggie Pinkham picture Reggie Pinkham · May 13, 2014

Use the git add command, followed by a list of space-separated filenames. Include paths if in other directories, e.g. directory-name/file-name.

git add file-1 file-2 file-3