Building Enterprise JavaScript Applications
上QQ阅读APP看书,第一时间看更新

Creating a release branch

Now, let's create our release branch and name it release/0.1.0:

$ git checkout dev
$ git checkout -b release/0.1.0

If this was a real scenario, we'd deploy the branch onto a staging server for it to be more thoroughly tested. For now, let's assume we have found a bug: the text for facebook and twitter inside social-login.txt should be capitalized to Facebook and Twitter. So, let's make that fix and commit it directly on the release branch:

$ git checkout release/0.1.0
$ echo -e "Facebook\nTwitter" > social-login.txt
$ git add -A && git commit -m "Fix typo in social-login.txt"

Now, we would test the revised code again, and assuming there are no more bugs, we can merge it into master:

$ git checkout master
Switched to branch 'master'
$ git merge --no-ff release/0.1.0

When we merge, it will ask us for a commit message; we can just stick with the default message, Merge branch 'release/0.1.0':

Lastly, we should remember to apply the bug fixes we made on the release branch back into dev; if we have any other active release branches, we should apply it to those as well:

$ git checkout dev
$ git merge --no-ff release/0.1.0

We end up with a Git branch structure similar to this: