-1

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.

Hugo y
  • 1,421
  • 10
  • 20

2 Answers2

0

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
  • I tried that but this happened:
    `Remys:git-practice Remyce$ git add src Remys:git-practice Remyce$ git status On branch master nothing to commit, working tree clean`
    – Remyce Savanna Nov 16 '16 at 02:30
  • it shows this: `Remys:git-practice Remyce$ git status --ignored On branch master Initial commit nothing to commit (create/copy files and use "git add" to track) Remys:git-practice Remyce$ ` – Remyce Savanna Nov 16 '16 at 02:49
0

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.

gzh
  • 3,507
  • 2
  • 19
  • 23