How do I add the src directory instead of the individual files?

若如初见. 提交于 2019-12-08 12:22:58

问题


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.



来源:https://stackoverflow.com/questions/40622813/how-do-i-add-the-src-directory-instead-of-the-individual-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!