{"thread":{"id":"34686","subject":"re-ignoring a force added file","startedAt":"2013-08-13T18:31:21Z","lastAt":"2013-08-14T09:22:42Z","messageCount":2,"participants":["Raza Ali","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"225162","messageId":"520A7B79.4080306@ebi.ac.uk","threadId":"34686","inReplyTo":null,"subject":"re-ignoring a force added file","fromName":"Raza Ali","fromEmail":"rali@ebi.ac.uk","sentAt":"2013-08-13T18:31:21Z","receivedAt":"2013-08-13T18:31:21Z","isPatch":false,"sender":{"key":"rali@ebi.ac.uk","avatar":null},"body":"Dear Git Mailing List,\n\nI have force added a file we usually like to ignore (but keep in the \nrepository). That was a change a while ago, and cannot be undone without \nserious pain. I would like to re-ignore the file though, as we dont want \nto track changes to it. Some of the options I came across are not useful \nfor me. For example\n\ngit rm --cached FILE // removes the file from the remote repository if I \npush, not desirable\ngit update-index --assume-unchanged //Will ignore changes to the file \nlocally, but someone else clones and the file is tracked for them.\n\nWhat we would like is to go back to the old state of affairs: the file \nwas in the working directory when someone cloned from the remote \nrepository, but changes to the file werent tracked or committed.\n\nAny help would be appreciated.\n\nregards\n\nRaza\n"},{"id":"225194","messageId":"87ioz8hbj1.fsf@linux-k42r.v.cablecom.net","threadId":"34686","inReplyTo":"520A7B79.4080306@ebi.ac.uk","subject":"Re: re-ignoring a force added file","fromName":"Thomas Rast","fromEmail":"trast@inf.ethz.ch","sentAt":"2013-08-14T09:22:42Z","receivedAt":"2013-08-14T09:22:42Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Raza Ali <rali@ebi.ac.uk> writes:\n\n> I have force added a file we usually like to ignore (but keep in the\n> repository). That was a change a while ago, and cannot be undone\n> without serious pain. I would like to re-ignore the file though, as we\n> dont want to track changes to it. Some of the options I came across\n> are not useful for me. For example\n>\n> git rm --cached FILE // removes the file from the remote repository if\n> I push, not desirable\n> git update-index --assume-unchanged //Will ignore changes to the file\n> locally, but someone else clones and the file is tracked for them.\n>\n> What we would like is to go back to the old state of affairs: the file\n> was in the working directory when someone cloned from the remote\n> repository, but changes to the file werent tracked or committed.\n\nI highly doubt that this description is accurate:\n\nEither the file was actually in the repository (more specifically, in\nthe commit that git-clone chose to be checked out).  In this case, it\nappears in the worktree after cloning.  But its presence in the HEAD\ncommit of the resulting repo also means that it is tracked.\n\nOr it was not in the repository.  In which case it will not appear in a\nnew clone.  And there is no third option here.\n\nSo your \"old state\" in fact did not exist.  And it unfortunately is also\nnot attainable in more roundabout ways: any given file can only be\neither tracked or ignored (or untracked-but-not-ignored, but that's\nbeside the point).  You cannot use ignore rules to ignore files that are\ntracked.\n\nPlease check https://gist.github.com/canton7/1423106 for a list of other\nways to achieve what you are trying to do (link from the corresponding\nbot quote on #git).  But do note that --assume-unchanged is a rather\nmore dangerous beast than you may think, and I cannot recommend actually\nusing it.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}