You could use git from the start if you wish, this will keep a history of how your code evolved and you will also be able to use an older version of the code if necessary.
My suggestion was that it is faster to code directly on the VM or use rsync, than to push code on GitHub and pull it on the VM.
(Although I mostly skip using Git in toy projects, and just backup to Dropbox).
[1] If you push your changes to some offsite remote like Github, you are also backing up your code.