git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* index manipulation quickref
@ 2006-12-12 10:57 Nguyen Thai Ngoc Duy
  2006-12-12 11:16 ` Jakub Narebski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2006-12-12 10:57 UTC (permalink / raw)
  To: git

Hi,

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
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)
read a tree to index: git read-tree treeish, git reset treeish
read a file from a tree to index: git ls-tree treeish file|git
update-index --index-info --stdin
copy a file from index to workdir: git checkout-index file
refresh index: git update-index --refresh
copy entire index to workdir: git checkout-index
output a file from index to stdout: ?? (is there a command for this?)
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 treeish

Am I missing any operation here?
-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: index manipulation quickref
  2006-12-12 10:57 index manipulation quickref Nguyen Thai Ngoc Duy
@ 2006-12-12 11:16 ` Jakub Narebski
  2006-12-12 11:28 ` Santi Béjar
  2006-12-12 18:18 ` Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2006-12-12 11:16 UTC (permalink / raw)
  To: git

Nguyen Thai Ngoc Duy wrote:

> 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>"

> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: index manipulation quickref
  2006-12-12 10:57 index manipulation quickref Nguyen Thai Ngoc Duy
  2006-12-12 11:16 ` Jakub Narebski
@ 2006-12-12 11:28 ` Santi Béjar
  2006-12-12 18:18 ` Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Santi Béjar @ 2006-12-12 11:28 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git

On 12/12/06, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> Hi,
>
> 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:

Cool. But for "index-newbies" not "git-newbies" :)

We could add (if exists) the porcelain-ish equivalent as:

update file content to index:
  git update-index file
  git add file (the development version)

add a file to index:
  git update-index --add file
  git add file

delete a file from index:
  git update-index --remove [--force-remove] file
  git rm file

read a tree to index:
  git read-tree treeish
  git reset commit-ish # It changes also the HEAD

read a file from a tree to index:
  git ls-tree treeish file | git update-index --index-info --stdin
  N/A

copy a file from index to workdir:
  git checkout-index file
  git checkout file

refresh index:
  git update-index --refresh
  git status # It does more things

copy entire index to workdir:
  git checkout-index
  git checkout -f

output a file from index to stdout:
  git cat-file blob :file (or :n:file, where n=0,1,2,3 are the unmerged stage)
  ??

list files in index:
  git ls-files
  ??

compare index and workdir file listing:
  git ls-files (with lots of options here)
  git status?

diff between workdir and index:
  git diff-files
  git diff

diff between index and a tree:
  git diff-index --cached treeish
  git diff --cached treeish


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: index manipulation quickref
  2006-12-12 10:57 index manipulation quickref Nguyen Thai Ngoc Duy
  2006-12-12 11:16 ` Jakub Narebski
  2006-12-12 11:28 ` Santi Béjar
@ 2006-12-12 18:18 ` Junio C Hamano
  2006-12-12 21:32   ` Nguyen Thai Ngoc Duy
  2 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2006-12-12 18:18 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git

"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:

> 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:

I think this goes in the wrong direction.  For "newbies" the
Porcelain-ish set is supposed to be enough and if there is
something missing that they need to do update-index command
itself or a pipeline that involves update-index to achieve
common tasks, we should enhance Porcelain-ish that captures the
pattern.

I think quick-ref for Porcelain writers would not hurt, but they
have manuals.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: index manipulation quickref
  2006-12-12 18:18 ` Junio C Hamano
@ 2006-12-12 21:32   ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 5+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2006-12-12 21:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 12/13/06, Junio C Hamano <junkio@cox.net> wrote:
> I think this goes in the wrong direction.  For "newbies" the
> Porcelain-ish set is supposed to be enough and if there is
> something missing that they need to do update-index command
> itself or a pipeline that involves update-index to achieve
> common tasks, we should enhance Porcelain-ish that captures the
> pattern.

It is supposed to be porcelain command only. I figure what operation a
user may need when manipulating index, then find the corresponding
porcelain command.

As you can see, we have porcelain commands for most of operations. The
missing piece is reset a file in index (and maybe "git cat-file
::file" -- it's too cryptic). Hopefully "git reset -- file" will be
implemented soon.
-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-12 21:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-12 10:57 index manipulation quickref Nguyen Thai Ngoc Duy
2006-12-12 11:16 ` Jakub Narebski
2006-12-12 11:28 ` Santi Béjar
2006-12-12 18:18 ` Junio C Hamano
2006-12-12 21:32   ` Nguyen Thai Ngoc Duy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).