How to exclude a folder from rsync - rsync

I am using rsync to deploy a git branch with my production server. Currently, I got js files stored in two locations:
assets/js/
js/
When I run rsync using --exclude js, non of the both folders will be sync, while I want the assets/js/ folder to be synced and the js/ folder inside my root folder to be skipped. How can I achieve this?

You need to specify the pattern for those files and directories:
using:
CWRULE [PATTERN_OR_FILENAME]
CWRULE,MODIFIERS [PATTERN_OR_FILENAME]
so you would have something like
CW- js/
For even more detailed info you can see the man page at the section
Include/Exclude Pattern Rules
from this link, hope it helps

Related

git allow one directory while exclude rest folder in .gitignore fle

I have a Wordpress website in which I have code as shown below:
wp-content/uploads/
which exclude uploads wp-content/uploads/ from git commit. But now I reached to the case where I have to include a subfolder wp-content/uploads/MY_CUSTOM_PDF
How should I only allow MY_CUSTOM_PDF to be included in git commit while ignore the rest as it was earlier.
Solution already exist.!!
.gitignore exclude folder but include specific subfolder
if sometimes git command-line ignore not work due to already uploaded folder so use smartgit ignore unwanted error

How to ignore .dll files from all directories

I have a project and it has a lot of directories containing .dll files. Now I want to ignore all files having .dll extension from all directory. I have .gitignore file in root directory.I tried many combinations but none seems to work.
Please help
Just use
*.dll
That will ignore all .dll files recursively, in all folders.
Ignoring files
From time to time, there are files you don't want Git to check in to GitHub. There are a few ways to tell Git which files to ignore.
Create a local .gitignore
If you create a file in your repository named .gitignore, Git uses it to determine which files and directories to ignore, before you make a commit.
A .gitignore file should be committed into your repository, in order to share the ignore rules with any other users that clone the repository.
GitHub maintains an official list of recommended .gitignore files for many popular operating systems, environments, and languages in the github/gitignore public repository.
In Terminal, navigate to the location of your Git repository.
Enter touch .gitignore to create a .gitignore file.
The Octocat has a Gist containing some good rules to add to this file.
If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, you must untrack the file first, by running the following command in your terminal:
git rm --cached FILENAME
Create a global .gitignore
You can also create a global .gitignore file, which is a list of rules for ignoring files in every Git repository on your computer. For example, you might create the file at ~/.gitignore_global and add some rules to it.
Open Terminal.
Run the following command in your terminal:git config --global core.excludesfile ~/.gitignore_global

How to stop git (.gitignore) from tracking minqueue (wordpress plugin) cached changes

After entering "git status", I keep getting messages like wp-content/uploads/minqueue-cache/minqueue-9cbb4cb4-9cb6af13.js
even though I have added the following line to .gitignore file: /wp-content/uploads/minqueue-cache/*
. Why is this?
The slash in the beginning of /wp-content/uploads/minqueue-cache/* means starting from the directory where the .gitignore file is in, so your pattern will match all files and folders inside wp-content/uploads/minqueue-cache/ but not the files inside www.apis.de/wp-content/uploads/minqueue-cache/.
If you change the pattern to wp-content/uploads/minqueue-cache/* it will match all files and folders in all wp-content/uploads/minqueue-cache/ folders, no matter where they start.
If you change the pattern to /www.apis.de/wp-content/uploads/minqueue-cache/* it will match all files and folders exactly in this one directory.

How to change the path before injection

Is it possible to change the path of the injected file before injection occurs?
I am using Grunt/Bower/Connect/Wiredep, and my directory structure is:
www
|- dev-dist/
|- node_modules/
|- src/
|- vendor/
|- bower.json
|- Gruntfile.js
|- package.json
(Note: in my .bowerrc file I've added directory: vendor)
When I run the custom task grunt serve:dev it will create the directory dev-dist, I will then copy my index.html (only) to the folder, after which I run the task wiredep.
After running wiredep, the src paths to my dependencies are all prefixed with '../vendor/'. The problem is that when I run connect I have the option base: ['vendor', 'dev-dist', 'src']. When everything is served, the relative path to vendor doesn't make any sense because the vendor dir is already served at the root.
Is there a way I can modify the path to the injected files before wiredep injects them? (So I can remove the '../vendor')
What I would like to have happen is from the same workspace be able to run grunt serve:* and specify dev/stage/prod environments. This is why I did not want to serve the whole www directory.
Is there a way to exclude folders from being served in connect? (So instead of specifying base:[...], I can just exclude the stage-dist / prod-dist folders)
Thanks,
JD
You can use the option ignorePath with a regular expression
ignorePath: /\.\.\//,
from the wiredep to remove the ../ from the path that is getting injected. The configuration details are available over here https://github.com/taptapship/wiredep#configuration
I haven't used connect yet, so I am not sure of your second part of the question.

Why does Symfony create a separate vendor folder in my root?

when I install Symfony according to the guide (option 1 with composer) it creates the folder structure as expected (and mentioned in that guide):
path/to/webroot/
Symfony/
app/
src/
vendor/
web/
But in the root folder it also creates an empty vendor/ folder. In this vendor folder there is a subfolder named composer/.
path/to/webroot/
Symfony/
vendor/
composer/
Both directories are empty (no hidden files). So two questions:
Is this a required folder or is it kind of a bug that these folders are installed? Or may this be a directory for composer-specific files?
Can I delete this folder without any danger?
That empty folder is generated when you don't pass the target-directory parameter to composer:
php composer.phar create-project vendor/project target-directory [version]

Resources