For the same purpose, a system was created called Version Control System (VCS) . This will help you maintain and maintain versions of your code. Git , Mercurial are some VCS. Git is the most widely used. This allows you to not only support versions. It helps:
Keep snapshots of the code.
See changes in snapshots (commits)
Create branches and try out experimental features.
Automatically merge branches and resolve conflicts.
Therefore, I highly recommend that you learn how to use Git. Here you can find some good tutorials:
[Udacity course][1] [Tutorials Point][2] [Attlassian Git tutorial][3]
source share