git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: index manipulation quickref

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 12, 2006, 11:16 UTC
Message-ID
<elm2ur$3ib$1@sea.gmane.org>
In-Reply-To
<fcaeb9bf0612120257p35dc9483ob65eea9ae21b5f7b@mail.gmail.com>
Nguyen Thai Ngoc Duy wrote:
Show 5 quoted lines
> I'm trying to collect all operations related to index from user
> perspective and corresponding commands. The list may be put to git
> wiki if people think it can help newbies:
> 
> update file content to index: git update-index file
Or "git add file" woth new git.
> add a file to index: git add file
> delete a file from index: git update-index --remove --force-remove
> (or remove that file in workdir and do git update-index --remove)

Or "git rm file" (old version did remove only from index, new version is to remove also from working directory if it matches HEAD)

> read a tree to index: git read-tree treeish, git reset treeish
> read a file from a tree to index: git ls-tree <tree-ish> file|git
> update-index --index-info --stdin
> copy a file from index to workdir: git checkout-index file
Or just "git checkout -- file"
> refresh index: git update-index --refresh
> copy entire index to workdir: git checkout-index
Or just "git checkout"
> output a file from index to stdout: ?? (is there a command for this?)
"git cat-file -p ::<filename>"
Show 5 quoted lines
> list files in index: git ls-files
> compare index and workdir file listing: 
>    git ls-files (with lots of options here) 
> diff between workdir and index: git diff
> diff between index and a tree: git diff --cached <tree-ish>
diff between workdir and tree: git diff <tree-ish> 
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Nguyen Thai Ngoc DuyNext: Santi Béjar
Message 2 of 5 in “index manipulation quickref”
  1. Nguyen Thai Ngoc DuyDec 12, 2006
  2. Jakub NarebskiDec 12, 2006
  3. Santi BéjarDec 12, 2006
  4. Junio C HamanoDec 12, 2006
  5. Nguyen Thai Ngoc DuyDec 12, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.