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.

  • git ,,local push'' from feature branch to master, without checkout
  • git accuses that whole file was changed
  • How to close a branch WITHOUT removing it from history in git?
  • What is the difference between “git whatchanged — filename” and “git rev-list — filename”
  • Is it possible to disable do “push force”, which overwrite “master” trunk of repository?
  • xargs: git : Bad file number
  • 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?

  • How to get Git to clone into current directory
  • Git - How do I manage built files in different branches?
  • View the change history of a file using Git versioning
  • Config/initializers not pushing to repo
  • Merge up to a specific commit
  • Git Merge - Not merging all changes from remote branch
  • One Solution collect form web for “filtered version of git repository”

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

    filter driver

    In your case, you would:

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

    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.

    Git Baby is a git and github fan, let's start git clone.