{"id":67,"date":"2013-07-15T22:12:35","date_gmt":"2013-07-16T02:12:35","guid":{"rendered":"http:\/\/www.kevin-ferrell.com\/?p=67"},"modified":"2013-07-15T22:13:36","modified_gmt":"2013-07-16T02:13:36","slug":"how-to-permanently-remove-files-from-git","status":"publish","type":"post","link":"http:\/\/www.kevin-ferrell.com\/?p=67","title":{"rendered":"How To Permanently Remove Files From Git"},"content":{"rendered":"<p>I\u2019ve been using git as my source control system of choice for the past year or so now. We use it within the government agency I work at for all of our mobile projects because our development laptops are often offline and we need to be able to branch and commit changes to our local repos while we\u2019re offline. Git is great for this type of setup!<\/p>\n<p>I recently downloaded the latest build of the excellent PSPDFKit library that we\u2019re using in one of our projects for document viewing. I copied the new build into my XCode project, performed some regression testing, and committed the changes. Success! Except that somehow during this process I had actually copied my entire Downloads directory into my XCode project folder and committed it to my local git repo. This increased my repo size to around 2GB! I then deleted the folder and committed the delete but of course the folder and its contents was still in the repo\u2019s history.<\/p>\n<p>Luckily I was able to find this great <a title=\"post\" href=\"http:\/\/dalibornasevic.com\/posts\/2-permanently-remove-files-and-folders-from-a-git-repository\" target=\"_blank\">post<\/a> on Dalibor Nasevic\u2019s blog that describes how to permanently remove the files and folder from git:<\/p>\n<p>git filter-branch &#8211;tree-filter &#8216;rm -rf AwesomeProject\/Downloads&#8217; HEAD<\/p>\n<p>It looks like the filter-branch command has some cool options for specifying a range of commits to perform actions on as well. Once I ran this I was able to push my local branch to the master and was all set. I hope this tidbit helps someone else out as much as it helped me!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve been using git as my source control system of choice for the past year or so now. We use it within the government agency I work at for all of our mobile projects because our development laptops are often offline and we need to be able to branch and commit changes to our local [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":66,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[15],"class_list":["post-67","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-examples","tag-git"],"_links":{"self":[{"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67"}],"version-history":[{"count":2,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":69,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions\/69"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=\/wp\/v2\/media\/66"}],"wp:attachment":[{"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kevin-ferrell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}