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:

  • cp command should ignore some files
  • How to use 'cp' command to exclude a specific directory?

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

  • Why is the size of a copied git folder on exFAT bigger than its original on ext4?
  • In BASH How Can One Recursively Copy Only Content Version-Controlled by Git?
  • Emulate git cp, including files with spaces in names
  • git-archive vs. cp
  • Unable to copy all but ~ -files and .gitconfig to Git -repo
  • 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.

  • Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo
  • How to revert Git repository to a previous commit?
  • Git merge in a branch that was previously merged
  • /usr/local/bin/git-credential-osxkeychain: Syntax error: “(” unexpected
  • Git: Add part of (changed) file to index *by line numbers*
  • How can I make GitHub pages use the master branch?
  • 2 Solutions collect form web for “Copy .git folder terminal with copy all”

    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.

    try this?

    cp -a fetch fetch-copy

    Git Baby is a git and github fan, let's start git clone.