Git Tags & Branches
I have two branches master & develop. The idea is I work on the develop branch and merge changes in only when version numbers are being bumped IE to v1.1 from v1.0. And I apply hotfixes to the master branch for bugs only.
Each time a version is bumped I will merge develop into master and tag master with a point release increase.
I know I can switch back to a tag using
git reset --hard v1.0
Which works great. However in the scenario where I need to apply a hotfix to the master branch do you think it would be best off moving head to that commit then branching from it then merging back in re-tagging to v1.01 and re-pushing.
Meaning the code can be deployed again at v1.01 leaving the v1.0 tag still intact?
The setup with the two branches sounds perfectly fine.
Be aware that git reset --hard resets the current branch to the given commit, throwing away all newer commits. - That is most likely not what you want.
For hotfixes on the master branch. You should definitely leave your tags as they are and introduce a new minor version for the fixed code.
git checkout master #fix code git commit -am 'fixed bug' git tag $new_minor_version git checkout develop git merge master # optional, to apply the fix in develop, too
If master was as v1.0 and the new minor version is v1.0.1 then the first tag includes the bug while the latter does not contain it anymore.
As long as you do not plan to actively support multiple versions (like a 1.* branch and a 2.* branch) you don't need any more branches and everything is fine. :)