added generate-tag option, usage method and export-diff extracted into a function