← 返回命令列表

Linux command

git-update-index 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Mark file as unchanged

git update-index --assume-unchanged [file]

Mark file as changed

git update-index --no-assume-unchanged [file]

Skip worktree

git update-index --skip-worktree [file]

Refresh index

git update-index --refresh

Add file to index

git update-index --add [file]

Remove file from index

git update-index --remove [file]

说明

git update-index registers file contents in the working tree to the index. It is a low-level plumbing command used internally by `git add`. The most common use is the `--assume-unchanged` flag, which tells Git to temporarily ignore changes to a tracked file. The `--skip-worktree` flag serves a similar purpose but is intended for files managed by sparse checkout.

参数

--assume-unchanged
Ignore changes to file.
--no-assume-unchanged
Track changes again.
--skip-worktree
Skip worktree bit.
--no-skip-worktree
Clear skip-worktree.
--add
Add file to index.
--remove
Remove file from index.
--refresh
Refresh stat info.
--chmod _mode_
Set executable bit.

FAQ

What is the git-update-index command used for?

git update-index registers file contents in the working tree to the index. It is a low-level plumbing command used internally by `git add`. The most common use is the `--assume-unchanged` flag, which tells Git to temporarily ignore changes to a tracked file. The `--skip-worktree` flag serves a similar purpose but is intended for files managed by sparse checkout.

How do I run a basic git-update-index example?

Run `git update-index --assume-unchanged [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --assume-unchanged do in git-update-index?

Ignore changes to file.