Create automatic backup / version of the sketch when deploying - possible?


I'd like have saved automatically(!) the actual sketch while the deployment (parallel to the deployed *ino file). The saved file should have a timestamp or versionnumber in the file name. Something like
is this possible? I did not find anything in the preferences.txt

Best Regards

Bumb up ...still the question: is auto backup possible?

Simple answer NO.

It is up to the user to implement a simple versioning scheme to suit thier needs.

EG. Tag each save with V1, V2, V3 etc or a more conventional versioning number such as 1.0.1, 1.0.2

BTW bumping topics has no practical use around here and is likely to annoy some users.
This is after all a FORUM and not social media.

Waiting one or two days before bumping is very acceptable.

Hello Ballscrewbob

thank you for the response.

I think major/minor/patch-versioning and auto-backups are a different pair of shoes.
I store of course minor versions and also patches on functional changes. But when I am at formating the LCD outputs spread over my code, then this is a constant build-and-test-circle where I build every minute a new version. Unfortunately it easily happens that some find&replace or wrong copy&paste spoils my code (I think everyone here once started searching the missing bracket 400 lines of code above...). Working on text output format is nothing which anyone would cover by git-versioning.
I commented this CR at github: [Idea] New autobackup function · Issue #3539 · arduino/Arduino · GitHub

Best regards
Florian Anwander

Btw: coming from the Usenet (you may remember the grand-grand-daddy of social media...) I think that I am able to judge by the traffic of a forum/maillist/whatever whether bumping up a thread makes sense or not. So everybody sing: "Lady Bumb, Lady Bump...." (older than Usenet...) :wink:

OK, just to finish this: The following shellscript does the job at the moment. It has to be called in each director, where you are working at the moment, but this is better than nothing.

cd $PWD
TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
if [ ! -d backup ] ; then
   mkdir backup
   FILE=`ls *ino`
   cp $FILE backup/$TIMESTAMP-$FILE
while true ; do
TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
LASTFILE=`ls  -n backup| tail -n 1 | awk '{print $9}'`
FILE=`basename $PWD`
if [ $LASTFILE -ot $FILE ] ; then
   cp $FILE backup/$TIMESTAMP-$FILE
   echo "created $TIMESTAMP-$FILE"

PS: don't use it, while the summertime/wintertime switch :slight_smile: