Mild Fuzz
Mild Fuzz

Reputation: 30823

remove file that "is outside repository" in GIT

I have a file that is loitering in my git status saying it has been deleted, but when I try to git rm is, I get ***/***.php is outside repository. The folder it is in is certainly within the repo, so I am confused!

Upvotes: 4

Views: 6151

Answers (2)

apratt
apratt

Reputation: 51

I have struggled with a similar problem for a long time turns out that a simple but not intutive switch was the answer.

git add --update or just git add -u

will add modified files and remove deleted files.

And if you want to add new files as well: git add --all or git add -A

will add new files, modified files and remove deleted files.

Kudos to Geek Gumbo

And for more serious documentation check Git SCM

Upvotes: 5

Clinton
Clinton

Reputation: 3648

That is strange. But perhaps you just need to commit your changes? git status lists changes that have been staged but not committed yet. If you git commit your changes, git status shouldn't list the file as deleted anymore.

Upvotes: 3

Related Questions