maks blog

maks blog, Hacks, fun around free software.

maximilian attems
email maks

Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

There's more than one way to view this weblog; try these flavours on for size.

Other blogs in our institute or friends.

Mon, 09 Mar 2009

git: Throw away first X commits of a repository

Today got asked by a colleague, who wanted to throw away the early history of his repo. git allows you easily to rewrite the history start with:

echo $FIRST_SHA >> .git/info/graft
git filter-branch -f

Then with interactive git rebase you can rewrite this important initial commit. Of course you have to define $FIRST_SHA and your repo shouldn't be dirty.

[/tech] permanent link