Take the 2-minute tour ×

I currently have a personal git repository for some software that I have been working on. The repository used to contain personal information of other people in some of the configuration files, which I have in git because they are useful to tracked and help document how the configuration file works. The git repo also shows how the configuration file has changed over time, in terms of which version requires what. I've recently had the desire to publish the project onto github, so I created a branch and removed the personal information from the head, replacing each item with placeholders.

Aside from going back to each revision and "changing history", is there a way for me to "censor" the old information in all occurances (change it all at once) by replacing it with the new information in all occurrences, so if somebody were to roll it back, they would see the placeholders rather than the personal information?

share|improve this question
Delete the .git folder (all the history) and start with the now-safe files you do have? stackoverflow.com/q/9683279/139010 –  Matt Ball Sep 9 '12 at 4:09
"The git repo also shows how the configuration file has changed over time, in terms of which version requires what." This means that I'd like to maintain some history, as I find it helpful for future development, but much of it is irrelevant and exposes identity info. –  DavidJFelix Sep 9 '12 at 4:12

1 Answer 1

up vote 5 down vote accepted

You can run a git filter-branch on it which will modify the history of the branch and remove what you want. Then you could just add an example (placeholder) file in its place. Check out github's remove-sensitive-data help page

share|improve this answer
Would this simply filter the configuration file, or filter the revisions line by line? Say in the first revision, the config file said "John Doe" but in the second revision it said "Name: John Doe". Can I filter it so that the first config file says "[Name]" and the second says "Name: [Name]"? I'd like to preserve the history of the edits without keeping information that I think is irrelevant and unnecessary to share. –  DavidJFelix Sep 9 '12 at 4:17
@DavidJFelix filter-branch can do anything to the content with filter-branch's --tree-filter but you're going to have to write your own script or program to actually do the modifications you want for each revision. –  wjl Sep 9 '12 at 4:22
@wjl Alright. That seems reasonable. With that, I'll mark this as accepted. I can handle the rest. –  DavidJFelix Sep 9 '12 at 4:24

Your Answer


