What is the purpose of git update-index?

Asked

Viewed 625 times

3

I was facing issues with folders, which should have been ignored in the repository, but they weren’t even when I put in .gitignore, and I’ve done a lot of research to solve the problem.

Among several researches, I saw someone advising that, in some cases, it is better to use git update-index --assume-unchanged than using the .gitignore.

I would like to know what is the purpose of this command. What is it for?

And, noting that he uses the argument --assume-unchanged, there are other arguments that can be used?

1 answer

4


The command update-index updates the GIT index, the main use is to consider modified files as unmodified with the parameter --assume-unchanged. Another important parameter is the --no-assume-unchanged, undoing the previous command.

Another important command in this context is:

git ls-files -v | grep '^[[:lower:]]'

Used to list files marked as assume unchanged. Source.


Taken from the manual, the other parameters:

git update-index
    [--add] [--remove | --force-remove] [--replace]
    [--refresh] [-q] [--unmerged] [--ignore-missing]
    [(--cacheinfo <mode> <object> <file>)...]
    [--chmod=(+|-)x]
    [--[no-]assume-unchanged]
    [--[no-]skip-worktree]
    [--ignore-submodules]
    [--really-refresh] [--unresolve] [--again | -g]
    [--info-only] [--index-info]
    [-z] [--stdin] [--index-version <n>]
    [--verbose]
    [--] [<file>...]

The description of each parameter can be found at https://git-scm.com/docs/git-update-index

Browser other questions tagged

You are not signed in. Login or sign up in order to post.