Search code examples
gitgitignoregit-clone

How to bypass .gitignore?


We are trying to set up a new staging server and are attempting a git clone. We would like to one-time pull files from our .gitignore (data files which should exist but don't need to be current). Is there a way to ignore .gitignore just this once?


Solution

  • You can just have the files on default state on remote repository, remove the files from .gitignore, and ignore changes that will be made on already-tracked files locally using:

    git update-index --skip-worktree [filepath]
    

    Every collaborators of your project should ideally do this so they can modify the files locally without affecting the ones on remote repository.