How to get git to completely ignore a file? -
i'm working on collaborative project remote repo. 1 of source files in repo "configuration"-type file, , i'd maintain own local copy of file different 1 in remote, without git looking @ file. is, don't want git track file; don't want committed if use git commit -a; , don't want pushed when used git push remote. don't want delete remote repo, git rm --cached wrong.
a couple places (including 1 on stackoverflow) suggested using git update-index --assume-unchanged <config-file>. seemed work; if use git status, file isn't listed modified, , git commit -a doesn't try commit it. however, git still preventing me switching branches locally, between "master" , working branch. if try git checkout master go working branch master, or vice versa, get
error: local changes following files overwritten checkout: <config-file> please, commit changes or stash them before can switch branches. git checkout -f doesn't help:
error: entry '<config-file>' not uptodate. cannot merge. it seems switch branches, have rename file, use git checkout, rename back, every time switch. not going acceptable. neither using command git stash every time want switch branches, need lot.
the file listed in .gitignore.
how can git ignore file?
i'd problem not in tool, in process. i've had deal before when deploying apps , think solution this:
move
configfileconfig.sampleinsteadmake sure deployment/installation copies
config.sampleconfigif doesn't existdon't add
configgit @ - doesn't need trackedkeep
configin.gitignore, it's not committed accident in future
Comments
Post a Comment