1

I have a bitbucket project which, in it's early stages, included a binary access database.

Most of the changes to that file that were checked in were data changes; I want to discard the data changes while keeping the DDL changes and the file itself.

I've gotten as far as finding a list of all the commits that touch that file, with

$ git log --pretty=oneline --branches -- TradeDangerous.accdb

But I'm having a hard time wrapping my head around the git chicanery here.

Ideally I want to remove changes to the file from commits in a given range as well as, possibly, remove commits that are only to that file within the range. If you then checkout a commit somewhere within the range you'd get the file as it was at the start of the range.

The coup-de-grace is that I want to be able to push these changes to bitbucket.

The revision range I'm trying to work on right now is 7b9ba..c752fd

When I try

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch TradeDangerous.accdb' -- 7b9ba..c752fd

git responds with

Which ref do you want to rewrite?

At which point I'm stuck.

kfsone
  • 23,617
  • 2
  • 42
  • 74
  • 1
    Filter Branch doesn't accept SHAs, despite the help saying to pass in a "rev list"'. You need to pass in a 'ref', like 'master'. That said, you can't filter-branch a range, any commit that you change you have to change every other commit downstream of it. For this, it might be easier to interactive rebase. – Andrew C Sep 16 '14 at 20:49
  • Possible duplicate of [Removing large file from git history?](http://stackoverflow.com/questions/23437725/removing-large-file-from-git-history) – Paul Sweatte Jan 18 '17 at 23:31

0 Answers0