替代NetBeans中的代码同步

I'm currently using NetBeans on a couple of different machines running PHP project and uploading all file changes to a remote server. I'm trying to figure out what's the best way to synchronize the code between the two machines and the server so that I do not overwrite something written on one of the machines from the other when uploading to the server. The NetBeans synchronize mechanics are not sufficient as they often give wrong indication on whether a file has been changed or not. What I actually need is a way to check before each upload whether the file on the server has been changed and a code merge is needed or not. Open to any suggestions!

Use version control: git, mercurial, svn, etc. all integrate very well with NetBeans.

You can use a service like github or bitbucket to store your repositories and synchrization with your computers will be very easy.