Version control systems provide a way to track changes between source code versions. Git is most likely the most commonly used one nowadays. Git can be used in different ways and there is no one correct way to do it. However, there are some pitfalls that might make tracking of changes harder than it should be.
There are a lot of more thorough articles like Commit Often, Perfect Later, Publish Once on the subject.