1

The dump.rdb file accidentally fell into one of the commits and now I can’t remove it from tracking. I am trying this command:

git rm -r --cached dump.rdb

or this

git rm dump.rdb --cached

The result is the same:

fatal: path specifier “dump.rdb” does not match any file

But this file inside my repo:

ls
Gemfile           app               config.ru         Gemfile.lock      babel.config.js   db 
node_modules      public            yarn.lock         README.md         bin               dump.rdb
config            lib               package.json 
Roman
  • 743
  • 10
  • 21

1 Answers1

1

Check first if a simple rm is enough.

rm dump.rb
git status

If the status is clean, the file was not part of the commit in the first place.


But you could also check if that file was versioned in a past commit.
For that, don't use the obsolete BFG or git filter-branch.
Use new tool git filter-repo (directly in your regular local repository, although a backup is always a good idea before those kind of filtering)

Use a path filtering:

git filter-repo --path dump.rb --invert-paths

That will remove dump.rb from the Git repository history if it was present.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250