Q:

Want to change my master to an older commit, how can I do this?

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 so I can pulish that version, then I want to go back to the latest commit I was one initially.
How can I do this?

A:

If you want to do this and revert the master to the previous commit:
git checkout master~1            # Checkout previous commit on master
git checkout -b new_master       # Create branch for new master
git branch -D master             # Delete old master
git branch -mv new_master master # Make new_master master

Alternatively:
git reset --hard master~1        # Reset current branch to one commit ago on master

A:

Your question is unclear. I think what you are asking for is this:
git push -f origin $old_commit_id:master
What will this do? It will push the $old_commit_id commit to origin as the new head of origin’s master branch.
If that is what you wanted, you do not need to touch your local master branch at all.

A:

use git reset --hard <old commit number>
it will reset the HEAD to this old commit.
additionally, you need to use git push -f origin to alter the remote repo too.

