kishore . kishore . - 1 year ago 61
Git Question

how to add multiple files in git at the same time

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


git push?

dax dax
Answer Source

To add all the changes you've made:

git add .

To commit them:

git commit -m "MY MESSAGE HERE" #-m is the message flag

You can put those steps together like this:

git commit -a -m "MY MESSAGE HERE"

To push your committed changes from your local repository to your remote repository:

git push origin master

You might have to type in your username/password for github after this. Here's a good primer on using git. A bit old, but it covers what's going on really well.