the_prole the_prole - 3 years ago 232
Git Question

How to add all file to git repo from defined directory

I know how to add all files from current directory

git add .


How about defined directory? Something like this? Doesn't seem to work.

git add . ~/local-repo/

Answer Source

You’re looking for the -C option:

git -C ~/local-repo/ add .

From the manpage:

-C <path>
   Run as if git was started in <path> instead of the current working directory.

It allows you to perform actions on a git repository as if you were in it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download