Adding files in git


#1

Do I need to add each new file in git that is created after init?

Or does it happen when I do “git commit -a -v -m ‘test’”?

If so, can I just use “git .” and it will take new files and skip old
ones?


#2

You have to add files to git with:

git add .

This will add all new files. Command

git commit -a -m ‘…’

with add only already tracked and changed files and commit them with
given message.

On Apr 8, 9:02 am, Pål Bergström removed_email_address@domain.invalid


#3

Bosko I. wrote:

You have to add files to git with:

git add .

This will add all new files. Command

git commit -a -m ‘…’

with add only already tracked and changed files and commit them with
given message.

On Apr 8, 9:02�am, P�l Bergstr�m removed_email_address@domain.invalid

Thanks :slight_smile:


#4

Pål Bergström wrote:

Bosko I. wrote:

You have to add files to git with:

git add .

This will add all new files. Command

git commit -a -m ‘…’

with add only already tracked and changed files and commit them with
given message.

On Apr 8, 9:02�am, P�l Bergstr�m removed_email_address@domain.invalid

Thanks :slight_smile:

Also note that git add --all does what git add . does, but this form
might only attempt to add modified and untracked files, rather than
attempting to add every file in the project. I don’t know if it actually
matters though in practice.


#5

Robert W. wrote:

Pål Bergström wrote:

Also note that git add --all does what git add . does, but this form
might only attempt to add modified and untracked files, rather than
attempting to add every file in the project. I don’t know if it actually
matters though in practice.

I see. Good to know.