Hacker News new | past | comments | ask | show | jobs | submit login
Git: Grafting repositories (straubnet.net)
38 points by ben_straub on Aug 11, 2010 | hide | past | favorite | 3 comments



There's no need for grafts for what they are doing. "git filter-branch --parent-filter" will do what they want without any need to much around by hand with anything in the .git directory. There's even an example in the man page for that command showing how to use it for exactly what they are doing.


Grafts allow you to do a bunch of other neat stuff. I use Git as a backup system for SQL dumps, but since the repository will grow a lot I want to throw old dumps away.

So I just create a graft and rewrite my history so that it only contains 7 commits (7 days):

    git rev-list HEAD | sed '7q;d' > .git/info/grafts &&
    git filter-branch -f HEAD


I had to deal with this a while ago. Scripts resulting from my troubles are at http://github.com/mattsta/git-shrink




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: