简体   繁体   中英

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!

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM