I want to ignore a file/directory tree that was previously tracked - ignore it forever but have it not being deleted on a pull - just have it ignored on the repository the pull happened. Is this possible ? Why not (if not) ? How should I proceed ?
NB: the accepted answer in Remove a file from a Git repository without deleting it from the local filesystem - namely git rm --cached path
- will result in the file being deleted on a pull. Nasty. Not only that but "it will delete your file if you check out a revision from before the deletion and then check out a revision from after the deletion" (see this comment) See this question for other interesting comments/answers that do not address my issue however.
I am perfectly aware of the --assume-unchanged
flag but this is not what I want - I want to tell to git (and all repository clones) "hey, stop tracking this file/tree" but not "delete this file/tree" - so I want to --assume-unchanged
globally as it were. If it is not possible (why ?) I need a workaround.
For the record I am trying to bootstrap git to use it to keep/share history and I want to be able to stop tracking files/directories at will - without having them deleted.
Related:
- git assume-unchanged vs skip-worktree - the general advice for assume-unchanged should be taken with a grain of salt (on pull, reset --hard etc)
- git assume unchanged vs skip worktree - ignoring a symbolic link - see this answer for
core.sparseCheckout