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

Re: Deleting files

From
SShak <sshaikh@hotmail.com>
Date
Jun 12, 2008, 12:01 UTC
Message-ID
<g2r36d$2ju$1@ger.gmane.org>
In-Reply-To
<g2r1sb$tut$1@ger.gmane.org>

"Shak" <sshaikh@hotmail.com> wrote in message news:g2r1sb$tut$1@ger.gmane.org...

Show 28 quoted lines
> "Shak" <sshaikh@hotmail.com> wrote in message 
> news:g2r19e$s6e$1@ger.gmane.org...
>> Hi,
>>
>> Are files supposed to be continually tracked after commiting after 
>> deleting them?
>>
>> git status reports that files have been deleted as expected (they're not 
>> there anymore). I commit as wanted. I do some more work, but then git 
>> status still reports that the same files have been deleted. As such I 
>> have a historical list of "deleted" files that I may have been working on 
>> previously and had committed.
>>
>> I have to run git rm to erase these entries, but I've no idea how that 
>> affects my history.
>>
>> Shouldn't git add/commit remember that a file has been deleted 
>> previously?
>>
>> On a related note, once I do git rm on one of these files, git status 
>> sometimes reports that these rm'd files have been renamed to a new one 
>> instead! What's going on? :(
>
> To be clear on the last point, git seems to be incorrectly detecting that 
> I've copied (sometimes to the same directory) and renamed files. What's 
> the difference anyway? And is there anyway to override it's overzelaous 
> assumptions?
>

To rudely reply to my own message a second time, it seems I have to explicitly run "git add -u" to actually commit deletions before committing. I don't notice any changes in "git status" so there doesn't seem a way of knowing that it's required.

I've also noticed that renames aren't detected until you commit a delete.
This is all becoming very counter-intuitive :(
Shak 
Previous: ShakNext: Pieter de Bie
Message 3 of 6 in “Deleting files”
  1. ShakJun 12, 2008
  2. ShakJun 12, 2008
  3. ShakJun 12, 2008
  4. Pieter de BieJun 12, 2008
  5. ShakJun 12, 2008
  6. Alex RiesenJun 12, 2008

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.