Skip to content

Clean commit history without losing contribution statistics.

License

Notifications You must be signed in to change notification settings

ph101pp/git-opensource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-opensource

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.

Installation

$ npm install -g git-opensource

Usage

# 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.

Options

-F, --force

If set, TARGET_BRANCH will be overwritten if it exists.

-M, --keep-messages

If set, original commit messages will be preserved.

-A, --author-commit

If set, author of final squash-commit will be current git user.
Note: This affects contribution statistics.

-m [MESSAGE], --commit-message [MESSAGE]

Defines commit message for the final squash-commit.
Default: git-opensource

-h, --help

Displays help.

About

Clean commit history without losing contribution statistics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages