I track a lot of separate .dvc directories in a project I am working on. I would love it if there was a flag (say -g
) that would add, after adding to dvc, the .dvc file to the current staged git commit. It's not an important feature exactly, as I could just write a script, but I think it would add value for a lot of users.
I am completely ready to dive in and attempt to draft a PR to accomplish this on my own (and write tests) but I don't have enough free time or emotional fortitude to pursue this without first opening an issue for feedback on the idea. :)
Hi @bobertlo !
Good idea! We've had similar discussions in https://github.com/iterative/dvc/issues/1576 . Would you say that you would expect to see this option enabled by default? Or just as an explicit flag?
Re #1576 definitely not committing. I think an explicit flag would be good. Maybe a config option would be more appropriate for enabling this mode by default. Not something you would want to flip on in a minor release at least.
@bobertlo Config option sounds very good. Could totally start with that and then consider switching to that by-default in 2.0. :+1:
The implementation itself should be pretty simple, as we have a reminder message already with the list of edited files, so we could totally just use it to git-add something. https://github.com/iterative/dvc/blob/master/dvc/repo/scm_context.py#L6 . And the config option is easy to add in https://github.com/iterative/dvc/blob/master/dvc/config.py . Let us know if you'll have any questions :slightly_smiling_face: Check out our contrib guide https://dvc.org/doc/user-guide/contributing/core and feel free to ping us in #dev-talk channel on discord :slightly_smiling_face: Thank you for looking into this! :pray:
Thanks for the info! I'll start working on a draft of this feature as soon as I have time.
Hi. Will it also auto-stage dvc.yaml/lock files created by dvc run
?
@jorgeorpinel Yes, the PR adds code in the scm_context hook that displays the little message about changed files. Instead of warning you to stage them it stages them for you.
Most helpful comment
Thanks for the info! I'll start working on a draft of this feature as soon as I have time.