2

I'm currently in the process of removing lots of unnecessary files from a project and there are some particular paths that I'd like to keep on .gitignore but still present on the different servers, just not tracked.

I need the different servers to do this also when fetching the committed changes (i.e. don't remove the files, keep them locally, untracked and ignored).

For the sake of example, from this directory and intended result:

mydir/
├── directory1    # Keep ignored & untracked
├── directory2    # Merge modifications
├── directory3    # Remove completely
├── file1         # Keep ignored & untracked
├── file2         # Merge modifications
└── file3         # Remove completely

What would be the difference between deleting directory1 and file1 normally, as opposed to the command used to delete directory3 and file3 so that this change is persistent across different clients that will fetch the changes in this branch?

Note I need this change to be:

  1. Persistent across clients (through pull)
  2. Applicable on two different branches without losing the ability to merge them.

Update: I just found this write up explaining one possible way to do this by creating a bash script that does git rm --cache, the problem with this is that when reproducing on different servers with pull, I'm getting those files deleted.

Alain Jacomet Forte
  • 4,575
  • 6
  • 29
  • 41

0 Answers0