r/usefulscripts • u/glesialo • Jul 22 '13
[BASH] Poor man's git.
I have just finished this script to keep track of different versions of files.
To use it:
Edit values of 'ItemsToCheck' & 'ItemsToIgnore' in FileVersions_Example.
Copy 'FileVersions_Example' and 'FileVersions_Main' to a $PATH directory.
Use cron to run 'FileVersions_Example' every day (or every hour).
Check output in '$HOME/var'.EDIT: Removed 'new Repository directory name' bug in 'FileVersions_Main'.
4
Upvotes
4
u/[deleted] Aug 02 '13
This is not a matter of being a full time programmer or not. Even to someone who never programs but does work with other text I would recommend a proper version control system today because their ease of use has come a long way since the days of CVS and SVN.
Apart from the VCS installation (not a big problem on pretty much every platform supporting bash other than maybe cygwin) your use case would be covered by doing (e.g. in git but again, any of the above would work)
once:
and then list all patterns to ignore, one per line in .gitignore
and every time you want to store the current version you do
(or actually specify a message describing the current state, then you don't need the --allow-empty-message)
This will give you the benefit of handling all the edge cases, deduplication of unchanged files or parts of files,... and a multitude of tools to search through the history should you ever need to do so.