Work done as in "hotfix" is merged into develop and master branch so we should be careful with what we're doing. To make this process easy, we will use git flow command. For more information, click git flow link.


Install git flow


inanzzz@inanzzz:~/project$ sudo apt-get install git-flow

Update develop and master


inanzzz@inanzzz:~/project$ git checkout develop
inanzzz@inanzzz:~/project$ git remote update
inanzzz@inanzzz:~/project$ git pull origin develop
inanzzz@inanzzz:~/project$ git pull origin master

Checkout master


inanzzz@inanzzz:~/project$ git checkout master

Initialise git flow


Accept default options in questions.


inanzzz@inanzzz:~/project$ git flow init

Start hotfix branch


Make sure the hotfix tag 1.30.3 doesn't exist or used yet in remote repository. Command below will check you out into hotfix branch.


inanzzz@inanzzz:~/project$ git flow hotfix start 1.30.3

Finish off your work


inanzzz@inanzzz:~/project$ git add --all
inanzzz@inanzzz:~/project$ git commit -m 'message goes here'
inanzzz@inanzzz:~/project$ git push origin hotfix/1.30.3

Compare hotfix to master in GitHub


Go to your GitHub account and select "master" branch to compare your hotfix PR (pull request) instead of "develop" so it will read like “Inanzzz wants to merge 1 commit into master from hotfix/1.30.3” on top of your PR.


Finish off your hotfix


inanzzz@inanzzz:~/project$ git flow hotfix finish 1.30.3
Summary of actions:
- Hotfix branch 'hotfix/1.30.3' has been merged into 'master'
- The hotfix was tagged '1.30.3'
- Hotfix tag '1.30.3' has been back-merged into 'develop'
- Hotfix branch 'hotfix/1.30.3' has been locally deleted; it has been remotely deleted from 'origin'
- You are now on branch 'develop'

Git push


inanzzz@inanzzz:~/project$ git push
inanzzz@inanzzz:~/project$ git push --tag

Verify


If you go to Github account, you’ll see that the hotfix branch has been closed and deleted automatically. Also if you select "develop" and "master" branches from dropdown, you should see a note "Merge branch 'hotfix/1.30.3'".