·터미널 명령어

git update-index

git

쓰는 꼴

git update-index [--skip-worktree|--chmod=+x] <file>

색인을 직접 손봅니다 — 이 표시는 내 컴퓨터에만 남고 push되지 않으며, 추적 중인 설정 파일에 내 수정을 남겨 두는 것은 --assume-unchanged가 아니라 --skip-worktree입니다.

자주 쓰는 옵션

옵션
--chmod=+xrecord the executable bit, useful from Windows
--skip-worktreelet you keep local edits to a tracked file
--no-skip-worktreeundo that
--assume-unchangedpromise you will not edit it, as a speed hint only
--no-assume-unchangedundo that
--refreshupdate stat information after a filesystem change

예시

git update-index --chmod=+x scripts/deploy.sh

stages the executable bit so CI can run it

git update-index --skip-worktree config/local.json

keeps your local edits out of every diff

git update-index --no-skip-worktree config/local.json

puts the file back under normal tracking

되돌리는 방법이 여럿이라 헷갈립니다 — 가리키는 곳을 옮기는 것과 새 커밋을 얹는 것은 다릅니다.

읽는 방법

  • 대괄호 [ ]는 넣어도 되고 안 넣어도 되는 자리입니다.
  • 점 셋 …은 여러 개를 이어 쓸 수 있다는 뜻입니다.
  • 옵션은 대소문자를 가립니다 — -r과 -R이 다른 명령도 있습니다.

자주 묻는 것

Q. git update-index은 무엇을 하나요?

색인을 직접 손봅니다 — 이 표시는 내 컴퓨터에만 남고 push되지 않으며, 추적 중인 설정 파일에 내 수정을 남겨 두는 것은 --assume-unchanged가 아니라 --skip-worktree입니다.

Q. 어떻게 치나요?

git update-index [--skip-worktree|--chmod=+x] <file> — 대괄호는 생략할 수 있는 자리입니다.

Q. 옵션은 몇 개나 자주 쓰나요?

여기 정리한 것은 6개입니다. 전체 목록은 man git에 있습니다. 이 명령은 git 갈래입니다.

같이 보는 명령

man 페이지: man git-update-index