Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy files without .gitignore?

I had a few Javascript projects and I need to copy or move to another machine. And I would like to ignore files which are already in .gitignore. Now, when I copy the folder I got git ignored folders and files. But, I want to ignore those when I copy (Command + C). How can I configure it?

like image 222
Set Kyar Wa Lar Avatar asked Jan 03 '23 15:01

Set Kyar Wa Lar


2 Answers

You can use git clone:

$ git clone machine1:/path/to/project machine2:/target/path
like image 68
Mureinik Avatar answered Jan 05 '23 09:01

Mureinik


To remove ignored files from a repository, you can use git clean.

git clean -nx
  • -n means dry-run; it will cause it to list the files it would delete without actually deleting them.
  • -x means remove ignored files.

If you also need to remove directories, specify -d.

After making sure that what above command prints is what you want to remove, replace -n with -f to run it for real.

git clean -fx

Keep in mind that this will delete files, and there is no way of getting them back unless you have a backup.

More info at man git-clean.

like image 43
jsageryd Avatar answered Jan 05 '23 09:01

jsageryd