I want to go back to a specific commit in git annex as I lost most recent copies of a file and want to revert back to a previous revision, few months old. All remotes are dead but after reading few article, there might be a way to get the file back from the objects directory:
git annex whereis image whereis image (0 copies) failed git-annex: whereis: 1 failed
Thanks,
This works the same with git-annex as it does with regular git. You can use
git revert
orgit reset
or whatever.If I revert to a previous commit, the metadata changes are not reverted to their previous state. Is there a way to revert metadata? If I understood that correctly, the metadata are stored in a single git-annex branch: so there is no way to have two regular branches with different metadata for the same file, right? Does any call to git-annex metadata creates a new commit in the git-annex branch? The commit message of the git-annex branch are not super informative: they all say "update".
A related question: is there a way to get the git-annex branch commit that matches a regular/master branch commit?
Thanks.
Metadata is attached to keys, not files. (See
man git-annex-metadata
.) If the state you revert to has the same key, it will have the same associated metadata.AFAIU not in a way that is tied to the HEAD commit. You can run
git annex metadata --remove-all FILE
, but that will remove the metadata on the underlying key.Correct.
I believe so, provided the caller hasn't overridden
annex.alwayscommit
to "false".In my view generic messages like "update" make a lot of sense in the context of the behind-the-scenes git-annex branch. If you're inspecting it just because you're curious about what's happening underneath, you might find the output of
git log --stat git-annex
helpful.That being said, there is an
annex.commitmessage
config option if you want to override the message.https://git-annex.branchable.com/todo/be_able_to_specify_custom_commit_message_for_git-annex_branch_commit/
I don't think there is any such mapping by design.
Thanks for the detailed answer.
So the only way to revert metadata changes is to reset the git-annex branch to a previous commit with
git update-ref refs/heads/git-annex <commit>
.Thanks for the
git-log --stat
tip.I guess I could get an approximate match between the master and git-annex branches commits based on commit date.