As I am bringing order to my collection, I sometimes add wrong files to a repo (usually because they're in an unexpected place, it's a mess).
Is there a way to make git annex forget about having added the key, as in delete the according .log
file from the git-annex
branch's working dir?
I don't need the history to be rewritten but do want it to "soft forget" about the key's existance and stop trying to track or fsck
it.
I just gave it a try in a test repo and manually deleting a key's
.log*
files makes git-annex forget about that key's existance. The record of it having existed at some point is still there in the historical commits but git annex doesn't care about those.Not sure about unwanted side-effects in a real repo though.
git-annex-dead --key
.dead
but that only marks the key as dead and doesn't delete its record from the git-annex branch, does it?"
git-annex-dead
only marks the key as dead and doesn't delete its record from the git-annex branch" -- true. But, in theory, the presence of the dead key record would not affect you as a user? Or are there so many dead keys that they are slowing down git-annex?The usual git way of undoing changes would be to revert to an earlier state of the branch. This doesn't quite work with git-annex, because keys added on a reverted branch are still tracked in the current git-annex branch. I've asked about this in an earlier post (can't find it now), and the upshot was that there is not simple fix for this.
git-annex-forget --drop-dead
will "prune references to repositories that have been marked as dead"; maybe it can also prune dead keys?"
git-annex-dead
only marks the key as dead and doesn't delete its record from the git-annex branch" -- true. But, in theory, the presence of the dead key record would not affect you as a user? Or are there so many dead keys that they are slowing down git-annex?The usual git way of undoing changes would be to revert to an earlier state of the branch. This doesn't quite work with git-annex, because keys added on a reverted branch are still tracked in the current git-annex branch. I've asked about this in an earlier post (can't find it now), and the upshot was that there is not simple fix for this.
git-annex-forget --drop-dead
will "prune references to repositories that have been marked as dead"; maybe it can also prune dead keys?Marking a key as dead does stop fsck complaining about it, and necessarily means there are no copies of it tracked. So it kind of seems to me that meets the goal of "forget about the key's existance and stop trying to track or
fsck
it"I do think it would be reasonable to have git-annex forget --drop-dead also remove logs for dead keys, but for other reasons: It would reduce the size of the git-annex branch, and also eliminate mention of the key in the git-annex branch's history. forget dead keys
It'd also be helpful if this could be integrated into the unannex subcommand:
git annex add file
-> realise it shouldn't have been added ->git annex unannex --forget file
That would make for a rather intuitive and user-friendly workflow.
If the git-annex branch is unpushed, it could even be rebased to reflect that change but that might be too complicated to do reliably.
I think this is the same thing being discussed in ?dead files in checkout directly.