Christian Benincasa
Christian Benincasa

Reputation: 1215

Start tracking directory and all contained files with git

I have a directory inside of my local repo named 'd3' and I want to add the directory and all of the contained files with git. I've used this command with the main directory, but each time it add a submodule, which isn't what I want.

$ git add d3/

I've also tried this command from inside the d3 subdirectory to try and add all of the files, which is an example I've found in several guides.

$ git add .

I'm extremely new to git and I'm not sure why these commands won't add all of the files to the project. Am I missing something extremely obvious?

Upvotes: 1

Views: 4397

Answers (1)

Etaoin
Etaoin

Reputation: 8724

Running git add will stage those files for commit. That means that the next time you commit to your repository, they'll be included.

But nothing is stored until, after adding all the files you're ready to add, you run git commit. That's when a snapshot is taken and committed to history, and that's when the new files can finally be said to be added to your project.

As @GoZoner mentioned in a comment, you can use git status before committing to verify that the files have been staged.

For a good introduction to Git, try Git Magic.

Upvotes: 3

Related Questions