Reputation: 4644
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?
Upvotes: 6
Views: 2732
Reputation: 4643
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.
Upvotes: 1
Reputation: 311853
You can use git clone:
$ git clone machine1:/path/to/project machine2:/target/path
Upvotes: 10