dynamist / subgit

Sub-git repo handler
Apache License 2.0
0 stars 0 forks source link

Implement "subgit reset" command #32

Closed Grokzen closed 1 year ago

Grokzen commented 2 years ago

Implement subgit reset command. We want to have a new command that when run should do the git reset similar command on the selected git repos or all repos in the configuration. Resetting a git repo would throw away any unstaged or uncommited things and go back to the state or commit that we have defined in the .subgit.yml config file.

Precaution steps that should be taken is that it should always ask for user confirmation if it should reset a folder and the entire git tree. Compared to the delete command, this should be a bit more nicer to work with, but since we still are modifying and possibly deleting files or changes the user has done, we need to implement a confirmation step asking the user to really perform any actions and specially if there is things uncommited.

We also probably want to implement options for -y, --yes or something to allow for automation of this step for cases like CI

CLI command to implement would be something like

subgit reset (<repo>...) (-y)

Where if no repo is set, it means all repos, if one or more repos is explicitly set, then work only on them.

Most usefull use-case for this is ci-cd scenarios where you might clone the repos, make some operation and it might add in files etc into the cloned folders and you want to reset everything back but not have to reclone everything before continue with some other operation within the build.

Integration test this against existing repos and implement light unittests for this