tl;dr:
Is there a way to get Git to permanently exclude all working-copy changes in a subdirectory of a Git repository, from being listed in "untracked files" and "deleted files" in git status
and friends, without removing them from the remote origin?
I'm on a system that unavoidably renames certain files, but they shouldn't be renamed on the repository. I'm not working with those files, but they're cluttering up my git status
and git diff
output. Adding them to .gitignore
solves the untracked files problem, but it still says the files were deleted.
Long-winded explanation for the curious, and to avoid people saying I shouldn't be asking this question:
My working copy is in a shared folder that I'm trying to access from both a VM (Ubuntu in VMware Fusion) and the host (Mac OS X); I did the clone on the VM side. The VM's shared folders feature replaces :
with &%
in any filename as soon as it's written to the filesystem, and that's how OS X sees it. The problem is, my workplace's Git repository has hundreds of mission-critical files with :
in the filename, all in one big directory. I have no need to edit or use these files or the directory they're all in, but they show up as deletions and untracked files any time I want to use GitX or the command line utilities from the Mac side (which would allow me to do development without using up all my RAM for the VM,). Other than that, git on the Mac sees my other changes correctly, and it would work perfectly except for this one directory. I can't rename the files back to colons, since that's illegal on OS X (and breaks ls
if you try to mv
it, FWIW). Any other solution beside the one I mentioned is welcome! Thanks!
It is possible to mark paths in a git workspace as "unchanged", so that git status
and git diff
will not see that the file/path has been modified. E.g.:
$ echo "default_value=Foo" > local.properties
$ git add local.properties
$ git commit -m'Default local.properties'
$ git update-index --assume-unchanged local.properties
$ echo "default_value=Bar" > local.properties
$ git status
# On branch master
nothing to commit (working directory clean)
Once the "assume-unchanged" bit is set for the path, git will no longer expect any modifications to the file, and will not report any modifications.