15

Guys, even after using "git add ." I still have untracked files that I can't commit.

There was another question with the same problem, but in that case it was related to case-sensitive folder. I didn't change the name of any folders here.

3
  • 5
    Ok Guys, I feel stupid but I found the solution and I'm posting here since it might help someone else. My terminal was pointed into an inner folder inside the repository. Despite running "git status" showed all the untracked files inside the entire repository, running "git add ." adds only the untracked files in the specific dir you are pointing the terminal. So all I had to do was cd into the root dir for the repository, run git add . and I got all my untracked files tracked. Commented May 11, 2011 at 3:52
  • Which platform - Windows, Linux, Mac, something else? Of course, you need to add the untracked files before you commit - or use git commit -a (though the manual says: As a special shortcut,git commit -a will update the index with any files that you’ve modified or removed and create a commit, all in one step which does not say 'and will add untracked files'). So, can you add the files themselves manually? Commented May 11, 2011 at 3:55
  • git status . will give you the status for just the current directory, if that's really what you want - but in this case, showing the status for everything was definitely helpful, since it showed you that you hadn't added everything. Commented May 11, 2011 at 4:03

2 Answers 2

19

The . in the git add . command refers to the "current directory". So, running git add . will add all the files in the current directory and its subdirectories. You should ensure that you are in the correct directory before running git add ..

If you're one level down in a subdirectory, then git add .. would be equivalent to cd ..; git add ..

Sign up to request clarification or add additional context in comments.

Comments

8

git add -A is what you want. It will add everything. This includes files you deleted.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.