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

Re: recover lost file

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 10, 2023, 05:27 UTC
Message-ID
<xmqq1qcyw52k.fsf@gitster.g>
In-Reply-To
<xmqqmsvmw8oc.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 33 quoted lines
> You only said "a lost file" without giving any specifics, so it is
> totally unclear to readers of your message how strings like
> "titlesplit" and "filesplit" relate to what you are looking for.  In
> the above I randomly made a blind guess that it might be a function
> name, but I may be totally off the mark.
>
>  - Do you mean "I think the file I removed had a name with either
>    titlesplit or filesplit in it?"
>
>  - Or do you mean "I know that the file had a definition of a
>    function whose name was either titlesplit or filesplit?"
>
>  - Or something completely different from the above two?
>
> If I know all of the followings are true:
>
>  - I had the necessary contents committed in Git;
>
>  - I do not remember the filename at all, but I am sure I deleted it
>    and committed the deletion some time ago;
>
>  - I know the lost contents I am looking for had a string "frotz" in
>    it.
>
> then I would probably try
>
>     $ git log -Sfrotz --diff-filter=D -p
>
> which will look for all file deletions throughout the history,
> limiting the output to those that had string "frotz" in them.
>
> But again, it is unclear what useful clue you have to locate the
> lost file from your description, so ...
If the scenario were
 - I know the file were once committed in Git;
 - I do not remember the filename, but I think its name had either
   "frotz" or "nitfol" in it;
then I would try this instead:
    $ git log --diff-filter=D --summary -- '*frotz*' '*nitfol*'
Previous: Junio C Hamano
Message 3 of 3 in “recover lost file”
  1. Malik RumiNov 10, 2023
  2. Junio C HamanoNov 10, 2023
  3. Junio C HamanoNov 10, 2023

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.