{"thread":{"id":"60501","subject":"recover lost file","startedAt":"2023-11-10T03:03:18Z","lastAt":"2023-11-10T06:26:50Z","messageCount":3,"participants":["Malik Rumi","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"484687","messageId":"CAKd6oBxF8m09QnqZ46joVpcR3mrR4MRSO+kL8vELGwVhD=rgXg@mail.gmail.com","threadId":"60501","inReplyTo":null,"subject":"recover lost file","fromName":"Malik Rumi","fromEmail":"malik.a.rumi@gmail.com","sentAt":"2023-11-10T03:02:39Z","receivedAt":"2023-11-10T03:03:18Z","isPatch":false,"sender":{"key":"malik.a.rumi@gmail.com","avatar":null},"body":"I am looking for a lost file that was accidentally deleted about 18\nmonths ago. The docs I consulted are version 2.42.1. The git on my\nmachine is version 2.34.1\n\nI followed the instructions on this page”\nhttps://git-scm.com/book/en/v2/Git-Tools-Searching , the section “Line\nLog Search”. But I got an error.\n\nmalikarumi@Tetuoan2:~/Projects/hattie$ git grep titlesplit\nmalikarumi@Tetuoan2:~/Projects/hattie$ git grep filesplit\nmalikarumi@Tetuoan2:~/Projects/hattie$ git log -L :titlesplit\nfatal: -L argument not 'start,end:file' or ':funcname:file': :titlesplit\nmalikarumi@Tetuoan2:~/Projects/hattie$ git log -L :titlesplit:\nfatal: -L argument not 'start,end:file' or ':funcname:file': :titlesplit:\n\nI don’t know the purpose of the colon. Is it a boundary marker? Does\nit belong at the front of the search object, the end, or both?\n'start,end:file' sounds like the error message expects me to provide a\nstart and an end, to which the obvious reply is - If I knew where it\nwas, I wouldn’t be trying to find it.\n\nWhat is the correct syntax?\n\nIs there another search option?\n\nThanx\n\n\n\n\n---\n“None of you has faith until he loves for his brother or his neighbor\nwhat he loves for himself.”\n"},{"id":"484690","messageId":"xmqq1qcyw52k.fsf@gitster.g","threadId":"60501","inReplyTo":"xmqqmsvmw8oc.fsf@gitster.g","subject":"Re: recover lost file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-11-10T05:27:47Z","receivedAt":"2023-11-10T06:26:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> You only said \"a lost file\" without giving any specifics, so it is\n> totally unclear to readers of your message how strings like\n> \"titlesplit\" and \"filesplit\" relate to what you are looking for.  In\n> the above I randomly made a blind guess that it might be a function\n> name, but I may be totally off the mark.\n>\n>  - Do you mean \"I think the file I removed had a name with either\n>    titlesplit or filesplit in it?\"\n>\n>  - Or do you mean \"I know that the file had a definition of a\n>    function whose name was either titlesplit or filesplit?\"\n>\n>  - Or something completely different from the above two?\n>\n> If I know all of the followings are true:\n>\n>  - I had the necessary contents committed in Git;\n>\n>  - I do not remember the filename at all, but I am sure I deleted it\n>    and committed the deletion some time ago;\n>\n>  - I know the lost contents I am looking for had a string \"frotz\" in\n>    it.\n>\n> then I would probably try\n>\n>     $ git log -Sfrotz --diff-filter=D -p\n>\n> which will look for all file deletions throughout the history,\n> limiting the output to those that had string \"frotz\" in them.\n>\n> But again, it is unclear what useful clue you have to locate the\n> lost file from your description, so ...\n\nIf the scenario were\n\n - I know the file were once committed in Git;\n\n - I do not remember the filename, but I think its name had either\n   \"frotz\" or \"nitfol\" in it;\n\nthen I would try this instead:\n\n    $ git log --diff-filter=D --summary -- '*frotz*' '*nitfol*'\n\n\n\n\n"},{"id":"484691","messageId":"xmqqmsvmw8oc.fsf@gitster.g","threadId":"60501","inReplyTo":"CAKd6oBxF8m09QnqZ46joVpcR3mrR4MRSO+kL8vELGwVhD=rgXg@mail.gmail.com","subject":"Re: recover lost file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-11-10T04:09:55Z","receivedAt":"2023-11-10T06:26:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Malik Rumi <malik.a.rumi@gmail.com> writes:\n\n> I am looking for a lost file that was accidentally deleted about 18\n> months ago. The docs I consulted are version 2.42.1. The git on my\n> machine is version 2.34.1\n>\n> I followed the instructions on this page”\n> https://git-scm.com/book/en/v2/Git-Tools-Searching , the section “Line\n> Log Search”. But I got an error.\n>\n> malikarumi@Tetuoan2:~/Projects/hattie$ git grep titlesplit\n> malikarumi@Tetuoan2:~/Projects/hattie$ git grep filesplit\n> malikarumi@Tetuoan2:~/Projects/hattie$ git log -L :titlesplit\n> fatal: -L argument not 'start,end:file' or ':funcname:file': :titlesplit\n> malikarumi@Tetuoan2:~/Projects/hattie$ git log -L :titlesplit:\n> fatal: -L argument not 'start,end:file' or ':funcname:file': :titlesplit:\n>\n> I don’t know the purpose of the colon. Is it a boundary marker? Does\n> it belong at the front of the search object, the end, or both?\n> 'start,end:file' sounds like the error message expects me to provide a\n> start and an end, to which the obvious reply is - If I knew where it\n> was, I wouldn’t be trying to find it.\n\nWhatever documenttion that gave you \"-L\" perhaps did not give you a\ngood example.  \n\n    $ git log -L\"20,+5:helloworld.c\"\n    $ git log -L\"/^titlesplit(/,/^}/:helloworld.c\"\n    $ git log -L\":titlesplit:helloworld.c\"\n\nare ways to follow, how the range of lines in the helloworld.c file\nof the CURRENTLY CHECKED OUT version, came about throughout the\nhistory, going backwards.  The way to specify the range in the\ncurrent version of helloworld.c file may be different (the examples\nshow \"starting at line #20, for five lines\", \"starting at the line\nthat matches the pattern \"^titlesplit(\", and ending at the line that\nmatches the pattern \"^}\", or \"the body of the 'titlesplit' function\n(according to the xfuncname logic)\"), but they share one important\ndetail that may make the feature unsuitable for your use case.  You\nneed to exactly know where in the current version of which file the\nline range you want to follow resides, but from your description I\nam getting an impression that you do not even know the name of the\nfile.\n\nYou only said \"a lost file\" without giving any specifics, so it is\ntotally unclear to readers of your message how strings like\n\"titlesplit\" and \"filesplit\" relate to what you are looking for.  In\nthe above I randomly made a blind guess that it might be a function\nname, but I may be totally off the mark.\n\n - Do you mean \"I think the file I removed had a name with either\n   titlesplit or filesplit in it?\"\n\n - Or do you mean \"I know that the file had a definition of a\n   function whose name was either titlesplit or filesplit?\"\n\n - Or something completely different from the above two?\n\nIf I know all of the followings are true:\n\n - I had the necessary contents committed in Git;\n\n - I do not remember the filename at all, but I am sure I deleted it\n   and committed the deletion some time ago;\n\n - I know the lost contents I am looking for had a string \"frotz\" in\n   it.\n\nthen I would probably try\n\n    $ git log -Sfrotz --diff-filter=D -p\n\nwhich will look for all file deletions throughout the history,\nlimiting the output to those that had string \"frotz\" in them.\n\nBut again, it is unclear what useful clue you have to locate the\nlost file from your description, so ...\n\n"}]}