问题
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