Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git update-index --assume-unchanged returns error

Tags:

git

ignore

git update-index --assume-unchanged <filename> returns fatal: Unable to mark file <filename>.

What do I need to do to fix this? What is it complaining about and why?

like image 308
Sreeram Ravinoothala Avatar asked Dec 22 '11 02:12

Sreeram Ravinoothala


People also ask

What is assume unchanged in Git?

When the "assume unchanged" bit is on, the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index. If you want to change the working tree file, you need to unset the bit to tell Git.

What is Skip Worktree?

--skip-worktree explained: This allows you to make changes to a file that you don't want to be pushed to upstream. Use this option as already shown above.

How do I ignore a file in Git?

If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.


1 Answers

Is it added to the repository, not in .git/info/exclude and not on .gitignore?

If the answer is yes to either of those, then the file is not in the repository and this is the reason for the error.

Try git ls-files -o and see if the file is there. It should not be.

like image 178
Pedro Nascimento Avatar answered Sep 28 '22 18:09

Pedro Nascimento