Search code examples
gitrelease-management

How to filter particular files for the release from a git repository?


Please, it is possible to create an independent branch in development git repository which would contain only specific file(s) for a release without regression tests e.g.? How?

For example, I want to create this branch containing only the perl command and push it to the git repository in /usr/local/bin. The merge with the master branch there would be the deployment with a (change and release) history track but without the history of tests development etc.

I read Git: Transfer Specific Files and Histories From One Repository to Another but I don't want to create a whole new repo with filter-branch. I would prefer to create only a release branch with the whole history but stripped to the particular file. Let say a combination of git log --file and git filter-branch.


Solution

  • Release management should be separate from development.

    • development is managed in your version control tool (here git), with additional files (like your test files)
    • release is a process which takes a package (in your case, all files except the test ones) and deploy them (here simple copy to /usr/local/bin)

    You shouldn't need to tweak the history of your repo to represent the "package" (set of files to be deployed in a target environment).
    You should push your repo to a bare repo on the server (the target environment), and let a post-receive hook take care of the deployment (the copy of the right files to /usr/local/bin)