Sometimes I need to perform following command
cp -rv demo demo_bkp
However I want to ignore all the files in directory .git . How do I ach
To ignore a git directory specifically, I'd try git export first.
But in general, to copy a directory tree excluding certain files or folders, I'd recommend using rsync instead of cp. The syntax is mostly the same, but rsync has way more options, including one to exclude selected files:
rsync -rv --exclude=.git demo demo_bkp
See e.g. the man page for more info.