I had a personal project I wanted to put onto Gitorious, but I didn’t want all of the history put up there because I had some username/passwords in the history as part of some test code. These pieces were gone in the more recent versions of the code. But git makes it so easy to recall and search history, it’s the sort of thing best not to risk.
After mucking with filter-branch
and rebase
, neither of which really gave me a repository I wanted to put out there, I came across the fast-export
and fast-import
commands. The export command, particularly, was quite flexible and I was able to arrive at a workable solution. I used fast-export
to dump the last 10 commits of my master branch up to HEAD
into a file, and then imported it into a new repository, finally pushing the result out to Gitorious.
Here’s the fast-export
command I used:
git fast-export master~10..master >> export
I still have the original repository, but I’ve mothballed it and will work from the new one. Seems like a reasonable compromise and ended up being a pretty straight-forward application of the available tools. No worrying about unintended side effects or subtle forms of data loss.