how to force a download of accidentally deleted files?

Started by dinguz, November 28, 2021, 09:32:53 PM

Previous topic - Next topic

I have done this:

    # pkg install git
    # cd /usr
    # git clone https://github.com/opnsense/tools
    # cd tools
    # make update


After that, I have made some local changes to build a custom kernel, which worked fine.
However, I accidentally removed some files. How do I download them again? If I do 'make update' it recognizes them as locally deleted, but doesn't seem to offer an option to re-download them.
In theory there is no difference between theory and practice. In practice there is.

Use git checkout restore deleted file from git repository. Also you can use the command git rev-list to find the checksum of the deleted commit. You can check out that commit too.
-RackG

Everything seems to be wrapped in these 'make' commands. Are we supposed to invoke 'git' directly?
Besides that, I am not sure what is the right syntax for these commands is.

root@jdjdehaan:/usr/tools # git checkout /usr/core/src/opnsense/service/templates/OPNsense/Proxy/squid.conf
fatal: /usr/core/src/opnsense/service/templates/OPNsense/Proxy/squid.conf: '/usr/core/src/opnsense/service/templates/OPNsense/Proxy/squid.conf' is outside repository at '/usr/tools'
root@jdjdehaan:/usr/tools # git checkout src/opnsense/service/templates/OPNsense/Proxy/squid.conf
error: pathspec 'src/opnsense/service/templates/OPNsense/Proxy/squid.conf' did not match any file(s) known to git

In theory there is no difference between theory and practice. In practice there is.

AFAIK Tools directory does only make update, however git management should be done directly. You have tired the command out side the repository i.e from /usr/tool instead of /usr/core/ hence it failed. You need to change the corresponding directory  to /usr/core/ before you try any git command. For more details @ https://www.git-tower.com/learn/git/faq/restoring-deleted-files will help you.
-RackG

Thanks, I supposed I made some trivial mistake but couldn't find out what exactly  ;)
In theory there is no difference between theory and practice. In practice there is.