Dvc: Keep -o data files within branch

Created on 6 Feb 2019  路  2Comments  路  Source: iterative/dvc

When generating intermediate files like model.h5 with dvc run ... -o model.h5 ..., this h5 file is added to gitignore in that branch. This is working as I expect it to, with only the model.h5.dvc file pushed to git.

The issue I have is, when I switch from this branch to some other branch, the model.h5 file is present in this other branch as well since the file isn't under git control. I need to manually remove this file from this as well as all other branches on my local.

What would be an elegant way to handle this? Thank you!

question

Most helpful comment

Oh I see, I was only doing git checkout and expecting data to change as well along with the source code. Thanks!

All 2 comments

Hi @ChintanTrivedi !

Great question! :slightly_smiling_face: You could call dvc checkout there yourself, which would checkout all the data files in that branch, and will also remove all the old links(e.g. model.h5). Or you could try installing it as a git post-checkout hook by either adding exec dvc checkout yourself to .git/hooks/pre-checkout or using dvc install to do that for you.

Oh I see, I was only doing git checkout and expecting data to change as well along with the source code. Thanks!

Was this page helpful?
0 / 5 - 0 ratings