title: Overwrite file in gulp stream
body: <p>I have following directory structure:</p>
  
  <pre><code>common
  -services
  --service1.js
  --service2.js
  -app
  --gulpfile.js
  --src
  ---services
  ----service1.js
  ----service3.js
  </code></pre>
  
  <p>I want to made gulp task that will take all files from common directory, take files from app directory and replace all files with same filenames in original stream. After that I will concat it and write to other directory.
  I tried this:</p>
  
  <pre><code>var gulp = require('gulp'),
      merge = require('gulp-merge'),
      concat = require('gulp-concat');
   gulp.task('templates', function () {
    return merge(
      gulp.src(['../common/**/*.js']),
      gulp.src(['src/**/*.js'])
    )
      .pipe(concat('app.js'))
      .pipe(gulp.dest('build/js'));
  });
  </code></pre>
  
  <p>I expected to got content of common/services/service2.js, app/src/services/service1.js, app/src/services/service3.js in dest/app.js.
  But instead I've got content of all files. 
  I tried to change cwd or base of gulp.src,  but it has no effect.
  I know that I can write this stream to tmp directory, and after that get files from it, but it seems not really like gulp-style solution. So how can I overwrite files with same file names in streams?</p>