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?

Answers


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. :)


Need Your Help

issue with smooth transition when div is sliding up

css transition smooth

Hi I have 2 divs (one on top of each other)contained within a parent div. on hover I want the top div to slide u and reveal the red div below it. I have sort of got it working though it does not

jQuery animate()-call is very slow

javascript jquery performance animation jquery-animate

I am using jQuery for my single page web application and am now in the need of animating a single DIV's height from a fixed value to another fixed value (from ~50px to 75px).