1

We would like to open source a library that we've been working on internally for some time.

The problem is that we use Phabricator and when commits are made, their descriptions contain details about code-review, and sometimes sensitive data. The commit titles themselves do not contain such sensitive information.

We'd like to actually copy the entire repo into a new repo, and keep the commit history intact (i.e., the titles, authors, diffs etc) but scrub out just the descriptions.

Because we're using Phabricator, we only have one branch (master) to start with.

I'd imagine we could use git filter-branch with the --commit-filter option, but my expertise stops there.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Arjun Mehta
  • 2,500
  • 1
  • 24
  • 40

1 Answers1

3

You can use the --msg-filter switch of git filter-branch. For each commit, it receives the commit message via standard input and applies the given "script" on it. In your case, you could keep just the first line of the commit message (the title):

$ git filter-branch --msg-filter 'head -1'
Mureinik
  • 297,002
  • 52
  • 306
  • 350