Before opensourcing, it is common practice in (larger) companies to erase all history from a projects git repository. This ensures that no proprietary information or IP remains anywhere in the commits which could cause legal issues or security vulnerabilities. However, this practice also contradicts one of the core fundamentals of opensource culture: Give credit where credit is due.
git-opensource is a small utility trying to solve this problem. It rewrites the current branch to a new target-branch, erasing all content from the commit history while preserving information about contributors and their statistics.
$ npm install -g git-opensource
# prepare$ cd ./path/to/your/repository$ git checkout "branch_to_rewrite" # i.e. "master"# run$ git-opensource <OPTIONS> [TARGET_BRANCH]
The newly created
TARGET_BRANCH can now safely be published to the community. It only contains the final version of your code, ensuring that there is ZERO proprietary information or IP hidden in its history. At the same time it still contains all information about contributions to the project.
If set, TARGET_BRANCH will be overwritten if it exists.
If set, original commit messages will be preserved.
If set, author of final squash-commit will be current git user.
Note: This affects contribution statistics.
Defines commit message for the final squash-commit.