Search code examples
gitmacosrecursioncp

Copy .git folder terminal with copy all


I'm trying to use cp to copy all files from sub-folder to current folder in zsh on osx. I basically want to have the problem these people are trying to get around:

I want the opposite. When I copy files, my .git folder is NOT being copied along with the rest of the files.

I've tried the following to no avail:

cp -RLv fetch/* ./
cp -RL fetch/* ./
cp -Rv fetch/* ./
cp -R fetch/* ./
cp -rv fetch/* ./
cp -r fetch/* ./
cp fetch/* ./

Is this possible? I'm okay with using mv too if I have to.


Solution

  • The correct command is cp -r fetch/. ./

    Asterisk (*) doesn't work because it is extended by the shell, and by default it doesn't include dotfiles/directories.