Saturday, July 24, 2010

github and filter-branch fun

In between being driven crackers, I've been *attacking* just about every TODO and item in my backlog. Staying insanely busy has the benefit that there's minimal time to feel or think, until passing out cold >_>.

Except for a minor issue with power save, and tools for a couple programming languages to be installed, work on my laptop is virtually complete.

One thing I have finally accomplished is preparing my personal git repository for the hub. For almost two years now, I've kept the important stuff in my home directory under revision control. Now I at long last have an off-site backup of it, reduce need for pastebins, and I could care less if anyone finds the repo helpful 8=). I'm more concerned about freak system failure here... lol.  Somethings, like my vim files represent like 4 years of work so there is a wee bit of life/time investment here.


Projects get their own repositories as needed but top level stuff in $HOME shares one. Originally I used CVS, since my file server only came with that and RCS, and I didn't want to bloat it with Subversion. About five months later, I switched to git ;).

Here things are still very simple. The file server has a mirror of any important data, plus it has bare git repositories for various projects: backed up independently of my personal data. Plus project repos on several hosting sites.  It's good insurance: now my most important files have the same.


And of course being me, it's obvious that I generated a patch set and skimmed through the 17,000-18,000 some lines of data representing over 200 commits, before I would allow the repo to get pushed into a public place.  I tend to be cautious in what I commit, to much so in fact. This repo however was always meant to be "Private", and programs sometime become probmatic. I only found one instance where this was a concern, minor but still rather something that should be compromised.

The solution of course is to just rewrite history:

$ git filter-branch --tree-filter 'git ls-files -z "filename glob" |xargs -0 perl -p -i -e "s/secret stuff/Censored By The Git History Cops!/g"' -- --all
$ git gc --aggressive --prune
$ git push --force origin
$ git remote add github git@github.com:Spidey01/Terry.git
$ git push github master

Also being myself, I made sure to first test the filter-branch in a fresh clone into /tmp, back up my .git directory, as well as verifying the log and format-patch output that it worked. Plus since I made a tag of a commit before updating master to reflect it's current machine: I also made sure to check that the tag remained unchanged from the filter-branch.



and now... I'm to darn tired to do more than pass out.

No comments:

Post a Comment