{"action":"created","issue":{"url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/issues/166","repository_url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner","labels_url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/issues/166/comments","events_url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/issues/166/events","html_url":"https://github.com/rtyley/bfg-repo-cleaner/pull/166","id":166665619,"number":166,"title":"Add --strip-trees-with-ids option","user":{"login":"ltrzesniewski","id":7913492,"avatar_url":"https://avatars1.githubusercontent.com/u/7913492?v=4","gravatar_id":"","url":"https://api.github.com/users/ltrzesniewski","html_url":"https://github.com/ltrzesniewski","followers_url":"https://api.github.com/users/ltrzesniewski/followers","following_url":"https://api.github.com/users/ltrzesniewski/following{/other_user}","gists_url":"https://api.github.com/users/ltrzesniewski/gists{/gist_id}","starred_url":"https://api.github.com/users/ltrzesniewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltrzesniewski/subscriptions","organizations_url":"https://api.github.com/users/ltrzesniewski/orgs","repos_url":"https://api.github.com/users/ltrzesniewski/repos","events_url":"https://api.github.com/users/ltrzesniewski/events{/privacy}","received_events_url":"https://api.github.com/users/ltrzesniewski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-20T19:46:11Z","updated_at":"2017-11-27T16:35:32Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/pulls/166","html_url":"https://github.com/rtyley/bfg-repo-cleaner/pull/166","diff_url":"https://github.com/rtyley/bfg-repo-cleaner/pull/166.diff","patch_url":"https://github.com/rtyley/bfg-repo-cleaner/pull/166.patch"},"body":"I was looking for a _reliable_ way to strip a directory based on its path, and this is a quick solution I came up with (since you said in #79 the proper built-in way would be hard to implement).\n\nThis simply adds a `--strip-trees-with-ids` option, based on what `--strip-blobs-with-ids` does. You _may_ prefer to merge both of these options into a single one, but I didn't want to break existing behavior.\n\nHere's how it's supposed to be used:\n\n``` bash\ngit rev-list --all --objects | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | grep -Pe '^\\w+ tree path/to/the/directory/to/delete$' | cut -d' ' -f1 > ./to-delete.txt\njava -jar bfg.jar --no-blob-protection --strip-trees-with-ids ./to-delete.txt\n```\n\nThis is _much_ more reliable than the solution in my previous comment [here](https://github.com/rtyley/bfg-repo-cleaner/issues/12#issuecomment-233701287), since it _only_ discards the subtrees, which means if any blob is also used in a _different_ path you don't intent to delete, it won't be affected.\n\nPlease note that I _absolutely_ don't know anything about Scala, and just hacked it together without really knowing what I was doing so please bear with me :smile: \n"},"comment":{"url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/issues/comments/347239765","html_url":"https://github.com/rtyley/bfg-repo-cleaner/pull/166#issuecomment-347239765","issue_url":"https://api.github.com/repos/rtyley/bfg-repo-cleaner/issues/166","id":347239765,"user":{"login":"jacquesknipper","id":26971170,"avatar_url":"https://avatars1.githubusercontent.com/u/26971170?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquesknipper","html_url":"https://github.com/jacquesknipper","followers_url":"https://api.github.com/users/jacquesknipper/followers","following_url":"https://api.github.com/users/jacquesknipper/following{/other_user}","gists_url":"https://api.github.com/users/jacquesknipper/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquesknipper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquesknipper/subscriptions","organizations_url":"https://api.github.com/users/jacquesknipper/orgs","repos_url":"https://api.github.com/users/jacquesknipper/repos","events_url":"https://api.github.com/users/jacquesknipper/events{/privacy}","received_events_url":"https://api.github.com/users/jacquesknipper/received_events","type":"User","site_admin":false},"created_at":"2017-11-27T16:35:32Z","updated_at":"2017-11-27T16:35:32Z","author_association":"NONE","body":"Would be very handy to have that option implemented 👍  :)\r\nI'm facing the exact same problem: same blob used for multiple copied files I don't want to remove.\r\nDo you plan to merge this MR?\r\nThanks!"}}
{"actor":{"display_login":"jacquesknipper"}}