DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Ground Truth for AI-Written Code: Why Context Matters More Than Prompts
  • The Real Skill Stack Behind Production-Ready AI Engineers
  • Multi-Agent Software Engineering: Can AI Teams Build Production Systems?

Trending

  • I Built a Java Version Manager by Fixing Other Tools' Open Bugs
  • Containerizing and Testing a Python Backtesting System With Docker and GitHub Actions
  • LocalStack and Terraform: A Clean Local AWS Setup Guide
  • Using LLMs to Automate Data Cleaning and Transformation Pipelines
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. How to do a Production Hotfix

How to do a Production Hotfix

By 
Ron Gross user avatar
Ron Gross
·
Aug. 14, 12 · Interview
Likes (0)
Comment
Save
Tweet
Share
12.1K Views

Join the DZone community and get the full member experience.

Join For Free

Situation
It’s Thursday/Friday evening, the daily version / master branch was deemed too risky to install, and you decide to wait for Sunday/Monday with the deploy to production.

There’s a new critical bug found in production.
We do not want to install the bug on top of all the other changes, because of the risk factor.

What do we do?
Develop the fix on top of the production branch, in our local machine, git push, and deploy the fix, without all the other changes.

How can I do this?

My example uses a Play Framework service, but that’s immaterial.

  1. gitk –all – review the situation
  2. Suppose the latest version deployed in prod is 1.2.3, and master has some commits after that.
  3. You checkout this version:

    git checkout 1.2.3
  4. Create a new branch for this hotfix.

    git checkout -b 1.2.3_hotfix1
  5. Fix the bug locally, and commit.
  6. Test it locally.
  7. git push
  8. On the production machine:
    1. git fetch (not pull!)
    2. sudo service play stop
    3. git checkout 1.2.3_hotfix1
    4. sudo service play start
  9. Test on production
  10. Merge the fix back to master:
    1. git checkout master
    2. git merge 1.2.3_hotfix1
    3. git push
  11. Clean up the local branch:


    git branch -d 1.2.3_hotfix1


    (Note: the branch will still be saved on origin, you’re not losing any information by deleting it locally)
Git Production (computer science) Hotfix

Published at DZone with permission of Ron Gross. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Ground Truth for AI-Written Code: Why Context Matters More Than Prompts
  • The Real Skill Stack Behind Production-Ready AI Engineers
  • Multi-Agent Software Engineering: Can AI Teams Build Production Systems?

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook