The whole idea of VCS is that you won't corrupt data by doing this. You can attempt to push, if your code is out of sync you will be told you have to accept the upstream changes before you can commit.
Once you have accepted the changes and merged them you can apply your code to the HEAD.