-->

How do I add the src directory instead of the indi

2019-06-10 02:08发布

问题:

I've created a directory called 'src' which contain the files 'level.txt' and 'notes.txt':

Remys:git-practice Remyce$ cd src

Remys:src Remyce$ ls

level.txt   notes.txt


How do I add the src directory instead of the individual files? It keeps coming up with:

Remys:src Remyce$ add src

-bash: add: command not found

I also need to commit the files to the repo.

回答1:

Go back to your git-practice directory, then

 git add src
 git status
 git commit -m "created a directory called which contain the files"
 git push


回答2:

Basically, git manage files with pathname, i.e. one node for one file, instead of folder. so you can not specify folder name only when run git add.

Please try the following command.

git add src/*
git status

Now you can see level.txt and notes.txt are in "to-be-committed" list.