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

replaced objects and working directory

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Jul 25, 2010, 04:20 UTC
Message-ID
<AANLkTi=3=MX8+U4Oq4q_RACyxFYj-HmBYXFBxxQdFf_e@mail.gmail.com>
Hi,

Should worktree (or the index) be aware of replaced objects? It seems a bit odd to do "git checkout HEAD^" then "git status" reports modification. Maybe "git status" and similar operations should also check worktree version against the replaced version, in addition to the original version?

$ git init $ echo 1 > 1 $ git add 1 $ SHA1=`git hash-object 1` $ git ci -m 1 $ echo 2 >> 1 $ git add 1 $ git ci -m 2 $ SHA2=`git hash-object 1` $ git replace $SHA1 $SHA2 $ git st # On branch master nothing to commit (working directory clean) $ git co HEAD^ $ git st # Not currently on any branch. # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: 1 # no changes added to commit (use "git add" and/or "git commit -a") $ git di

diff --git a/1 b/1
index d00491f..1191247 100644
-- 
Duy
Next: Jonathan Nieder
Message 1 of 2 in “replaced objects and working directory”
  1. Nguyen Thai Ngoc DuyJul 25, 2010
  2. Jonathan NiederJul 25, 2010

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.