87084

filtered version of git repository

I have a problem where we need to provide a filtered version of our git repository to an outsourcer.

So we need to maintain a version of our git repository that has certain keywords find and replaced with something else.

The reasoning behind this is we don't want the outsourcers pasting code in forums that has our clients name in it as it has happened in the past.

It would be cool if git could expose something like this on the fly, but I imagine that isn't possible because it would change all the SHA ids.

I guess the solution is to have 2 separate git repositories that are kept in sync somehow. The syncing would need to be 2 way. So that when we make changes to the code base, those changes get pushed to filtered code base (and filtered on the way) and if the the outsourcers make changes then those changes get pushed to our repository, but unfiltered on the way back.

We could probably rangle something together with cherry-picking, etc. But I imagine it'd be a bit of work to get it reliable. I suppose conceptually it's similar to git-svn.

Are there tools out there that could produce this outcome?

Answer1:

As Owen mentions in the comments, and as I illustrated in the answer he references, this is a job for a <strong>filter driver</strong>.

<img src="https://i.stack.imgur.com/3LTL2.png" alt="filter driver">

In your case, you would:

    <li>have a special branch where a git attribute declares a outsourcerscript</li> <li>maintain in that branch a outsourcerscript able to replace those keywords</li> <li>merge your work, and then checkout that branch in order to get a filtered working tree</li> <li>add the content of that working tree to your separate repo you need to communicate to the outsourcer.</li> </ul>

    For changes coming from the outsourcer, you add them to an import branch where a clean script will, on commit, restore the right keywords. And then you merge that import branch to your usual working branch.

Recommend

  • AbstractTableModel contains proper data but will not update on fireTablDataChanged
  • MySQL trigger to update SQL Server table
  • why does CouchDBs _dbs.couch keep growing when purging/compacting DBs?
  • MongoDB replication crashes and wouldn't start up again
  • libgit2sharp what is correct sha to supply to GitHub API merge pull-request?
  • Firebase Authentication is failing with “Developer Error” after uploading apk to google play store
  • gulp: passing dependent task return stream as parameter
  • readyRead() signal of QextSerialPort (QIODevice) is not being called fast enough
  • Safari WebCrypto API RSA-OAEP encryption
  • curl - How to escape < in parameter value
  • Android gradle : Error No resource found that matches the given name: attr when refer to an android
  • Modify a Google App Engine entity id?
  • PyYaml parses '9:00' as int
  • Injecting service into a mixin Ember2.3+
  • How to force Composer to download a local package?
  • Returning this from a constructor function in JS
  • Accessing local repository in offline mode
  • How can I see a list of all files that are different between two Hg repositories?
  • Receiver has no segue with identifier“***”
  • java.lang.IndexOutOfBoundsException occuring on ArrayList
  • Updating Dojo provide
  • netsh acl setting (need alternative method - registry settings?)
  • How can I replace the server in Web Component Tester
  • how to set variables in a php include file?
  • how do i write assembly code from c#?
  • Recording logins for password protected directories
  • Update CALayer sublayers immediately
  • Fetching methods from BroadcastReceiver to update UI
  • Excel - Autoshape get it's name from cell (value)
  • Check if a string to interpolate provides expected placeholders
  • Does CUDA 5 support STL or THRUST inside the device code?
  • WinForms: two way TextBox problem
  • what is the difference between the asp.net mvc application and asp.net web application
  • Calling of Constructors in a Java
  • RestKit - RKRequestDelegate does not exist
  • Traverse Array and Display in markup
  • Transpose CSV data with awk (pivot transformation)
  • Proper folder structure for lots of source files
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`