git-annex/ walkthrough/ removing files

When you're using git-annex you can `git rm` a file just like you usually would with git. Just like with git, this removes the file from your work tree, but it does not remove the file's content from the git repository. If you check the file back out, or revert the removal, you can get it back.

Git-annex adds the ability to remove the content of a file from your local repository to save space. This is called "dropping" the file.

You can always drop files safely. Git-annex checks that some other repository still has the file before removing it.

    $ git annex drop iso/debian.iso
    drop iso/Debian_5.0.iso ok

Once dropped, the file will still appear in your work tree as a broken symlink. You can use `git annex get` to as usual to get this file back to your local repository.

comment 4

Correct, dropping a file from everywhere will lose its content entirely.

But, git-annex has a copies tracking feature that prevents such foot-shooting. If you ask it to drop the last copy, it will refuse, although there is a way to override this if you really want to.

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Complete removal
So, and I hope this isn't too Captain Obvious, if we drop the file at each repo, we essentially remove it from existence as far as this git-annex cluster is concerned?
Comment by fbicknel — Wed Oct 29 14:05:27 2025
comment 2
Good catch. It used to be necessary before there was a git-annex branch, but not now.
Comment by http://joey.kitenet.net/ — Wed Oct 29 14:05:27 2025
Is it necessary to commit after the 'drop'?
In fact is it possible? Nothing changed as far as git is concerned.
Comment by DavidEdmondson — Wed Oct 29 14:05:27 2025
Comments on this page are closed.