Search code examples
gitignoregitignorepullgit-clone

Ignore a file in git but have it downloaded when the project is cloned


I have a file that suffers modification every time I run my project. Thus, I don't want git to track it and so I add it to my .gitignore file.

However, I do wish for the file to be pulled when cloning the project.

How can I achieve this?

Thank you in advance.


Solution

  • No you cannot ignore a file, not track it and expect it to be available in clone.

    What you can do is, add the file to the repo, run git update-index --assume-unchanged so that git "ignores" the changes to it and then you will have the file in clone.