I have used git various times to not only store my code but also to version control it as you've mentioned. I upload whatever code I come across on my github profile and then as much as I update it and I go further into it, I keep pushing the code to my git profile on git repository. Henceforth making sure and keeping in check the version of the project.
