Answer the question
In order to leave comments, you need to log in
Deleting files from a Git repository?
There is the following problem. Googling didn't turn up much.
There are develop and production git repositories, and between them there is a bare repository. The working copy of the application contains many more files than you need to keep in the repository. At the same time, the repository obviously contains files that are unnecessary for it, which, in the course of work, must be found and removed from the repository (but not from the working copy). It would seem that you need to use git rm --cached to remove files from control, add them to gitignore and that's it.
If you run git rm --cached on the dev repository, then the files will indeed be removed from the index, while remaining in the local working copy. However, after pushing them to the bare repository and a subsequent pull to production (or any other repository), these files, if present, will be removed from both the repository and the working copy.
The question is, can this be avoided? You need to be able to delete files from the repository, leaving them both in your working copy and in everyone else.
Answer the question
In order to leave comments, you need to log in
Did you watch it? git-scm.com/book/ru/%D0%9E%D1%81%D0%BD%D0%BE%D0%B2...
lezhnevs.ru/git/udalenie-papki-iz-repozitariya
There is no way to avoid deleting files in other repositories.
Alternatively, create a new repository with .gitignore already properly configured.
Or manually recreate the remote file in each remote repository after doing a pull.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question