git update-index --assume-unchanged returns error

前端 未结 3 1034
轻奢々
轻奢々 2021-02-19 00:05

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

What do I need to do to fix this? Wha

3条回答
  •  后悔当初
    2021-02-19 00:27

    For those wo have this issue trying to exlude a whole directory:

    I just had this issue and got quite confused. I had the directory added in .gitignore and one of the files showed up in git ls-files -o. Other files of this directory showed up in git status.

    I finally figured out that I had to treat the files in the directory differently, because some of them were already tracked and some were not. So I just used git update-index --skip-worktree (the in my case better version of git update-index --assume-unchanged , see here) on the files that were already tracked (the ones showing up in git status as being modified). In comparison to calling this command on the whole directory, this worked because I didn't try to exclude files that were not tracked yet and already excluded by .gitignore. The other files in this directory I didn't have to exclude with this command because they were already excluded by .gitignore.

提交回复
热议问题