Adding feature to specify "ref" for deploy

If the recent push happens on different "ref" we just dismiss it.
The "ref" is optional