I want to rollback to a previous commit, and then publish that code, then go back to the latest commit.
i.e. so my master is pointing to an older commit version just
You can just git checkout <commit-id>
, do whatever you need to do, then git checkout master
to get back to the new code.
If you actually need to modify the old code to release it, then you should probably:
git checkout -b my_release <commit-id>
... prepare code for release ...
... release code ...
git checkout master
git merge my_release
Also, I can't recommend git flow enough. It makes all of this quite easy.