Let’s say I have a new stable version to release and I want to back up the current one.
The first step would be to tag the stable release with a backup name.
$ git tag stable-2014-09-02 stable
Now we delete the stable tag
$ git tag -d stable
Now it’s time to mark the current commit(or any commit) as the stable tag(make sure to git log
to know which commit hash you want)
$ git tag -a stable -m "Tagging stable version" 60f7196
Next step is to delete the stable branch in the remote server
$ git push origin :refs/tags/stable
All done, it’s time to push the local tags
$ git push --tags
Counting objects: 1, done.
Writing objects: 100% (1/1), 171 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To git@github.com/xxxx/xxxx.git
* [new tag] stable -> stable
* [new tag] stable-2014-09-02_1 -> stable-2014-09-02
Counting objects: 1, done.
Writing objects: 100% (1/1), 171 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To git@github.com/xxxx/xxxx.git
* [new tag] stable -> stable
* [new tag] stable-2014-09-02_1 -> stable-2014-09-02
Quick, dirty and easy :D