benthayer / git-gud

Wanna git gud? Then get git-gud, and git gud at git!
MIT License
401 stars 42 forks source link

Force init #270

Closed benthayer closed 3 years ago

benthayer commented 3 years ago

Fixes #122

benthayer commented 3 years ago

@sahansk2 Is the the desired behavior?

sahansk2 commented 3 years ago

@benthayer Yep, this looks good!

This doesn't have to be in this PR, but do you think that we could have a feature where upon force initializing with --prettyplease, all the files in the current directory are committed to a bare repository in .git/gud, so that the user could run git gud restore-backup and restore their files?

benthayer commented 3 years ago

First, I think copying all the files is fine, we don't need to use git to archive files.

Beyond that, there may be some issues. If we keep archiving things. then we might end up with many more files than we'd expect. There are a couple things we could do.

I think one of the best ways to make sure that there aren't too many archives is to make an archive folder called .git/gud/archives and create a .git/gud/archives/{timestamp} folder with all the files in there. The only thing not copied would be .git/gud/archives, which would remain in place each time things are archived/deleted.

If we want to go back, then we can copy that folder, or make a git gud script to copy it, which I think would be overkill (but would definitely expedite the process) Overall, I think it's possible, but I don't see us using that much if --prettyplease does its job, but maybe with this improved functionality, we'd actually be more likely to use it and make use of it somehow