1

There's this folder that belongs to a different team that is totally unrelated to my own team's folder. I don't need nor want to keep it in my local repo.

How can I delete it locally without reflecting changes on Git, while still being able to push/pull everything else?

phd
  • 82,685
  • 13
  • 120
  • 165
AX2
  • 135
  • 12
  • 1
    See https://stackoverflow.com/questions/653454/how-do-you-make-git-ignore-files-without-using-gitignore - but I think that once a file is committed, you cannot ignore changes to it. – evolutionxbox Jul 29 '21 at 10:56
  • My advice is to use [sparse checkout](https://stackoverflow.com/search?q=%5Bgit%5D+sparse+checkout). – phd Jul 29 '21 at 14:46
  • 2
    Sounds like it should either be in another repo or should be a submodule – Liam Jul 29 '21 at 14:50
  • You need to delete the files/folder from repository and add an entry in .gitignore file (Create if not present). To know more on .gitignore: http://git-scm.com/docs/gitignore – Srini Karthikeyan Jul 29 '21 at 15:46

1 Answers1

0

Basically just ignore the folder yourself.

We work in a environment that is quite similar to what I think you are describing. Different teams work on different branches and make different folders, but there is some "leakage" (never mind why) so the folders of some other teams do appear in our branch. It's annoying but no more. We just don't look at those folders.

It's a bad architecture, but one can understand why it is organized this way, and there's not much we can do about it.

matt
  • 515,959
  • 87
  • 875
  • 1,141