2

I have to find a solution which ignore existing files like assume-unchanged but more dynamic.

I want:

  • When I do git status, git diff, git add, etc., it just behave like there's no such a directory. (like assume-unchanged)
  • When I do git pull, git rebase, git reset, git checkout, etc., it just behave like there's no such a directory.
  • Even when I add any new file into that folder, it must still be a ghost. (what assume-unchanged seems cannot do)
  • It's read-only so I don't have to consider about add, commit, push, etc.

Does anyone can help? Thanks a lot!

P.S. Some more details. Why I have to do this is because in my project they did check-in node_modules directory into the repository. If you did used msysgit with a node project on Windows, you may know the "File name too long" problem...

So I want to totally ban the node_modules in the repository and build my own one. I don't need to check-in any code so I won't consider about how to check-in my changes.

1 Answers1

1

If node_modules can be considered as its own repo, You could add that node_modules as a submodule, which would make it a simple (gitlink) entry in your index, that you can or cannot initialize.
Then you would be able to clone that same node_modules repo elsewhere (outside of your repo) for you to use.

That is different than just checking in the content of node_modules in an existing repo: that is about making it a repo of its own, which:

  • can be included in your repo (submodule)
  • can be checked out anywhere you want (in order to avoid your "Filename too long" issue)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks! I believe this can really fix my problem, if the project is not read-only to me. :( But currently I can only try to find some workaround other than to modify anything in that repository. – whitetrefoil Jun 11 '14 at 08:08