You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitFlow流程中发布版合并至master/develop后,生产Bug修复方案咨询

How to Handle a Delayed Release with Production Bug Fixes in GitFlow

Great question—this is a tricky edge case in GitFlow, but there’s a clear, team-friendly way to resolve it without mangling your branch history. Here’s your step-by-step playbook:

1. Roll back master and develop to the pre-release stable state

You already merged release/1.1 into both branches, but since the 1.1 launch is delayed, you need to get your branches back in sync with the current live production version (let’s assume that’s 1.0).

  • If you haven’t pushed the merges to remote yet:

    • Check out master and reset it to the last stable commit (use the 1.0 release tag or its commit hash):
      git checkout master
      git reset --hard <commit-hash-of-1.0-release>
      
    • Repeat the same reset for develop:
      git checkout develop
      git reset --hard <commit-hash-of-1.0-release>
      
    • Pro tip: Run git log --oneline to quickly find the right commit hash.
  • If you already pushed the merges to remote:
    Hard resetting rewrites public history (bad news for your team), so use git revert instead to create a new commit that undoes the merge:

    • Find the hash of the merge commit (look for lines like Merge branch 'release/1.1' in git log):
      git checkout master
      git revert -m 1 <merge-commit-hash>
      git push origin master
      
    • Do the same revert for develop:
      git checkout develop
      git revert -m 1 <merge-commit-hash>
      git push origin develop
      

2. Create a hotfix branch for the production bug

Since the issue is in your live 1.0 environment, use GitFlow’s hotfix workflow to target it directly:

  • Check out the now-stable master branch:
    git checkout master
    
  • Spin up a hotfix branch (name it to reflect the patch version, e.g., hotfix/1.0.1):
    git checkout -b hotfix/1.0.1
    

3. Fix the bug and merge the hotfix

  • Implement your bug fixes on the hotfix/1.0.1 branch, commit with clear messages, and test thoroughly.
  • Once the fix is validated, merge it back to master and tag the new production patch:
    git checkout master
    git merge hotfix/1.0.1
    git tag -a 1.0.1 -m "Hotfix: Resolve production instability"
    git push origin master --tags
    
  • Merge the hotfix into develop too—this ensures when you restart the 1.1 release later, the fix is included:
    git checkout develop
    git merge hotfix/1.0.1
    git push origin develop
    

4. Clean up and restart the 1.1 release

  • Delete the hotfix branch (local and remote if you pushed it):
    git branch -d hotfix/1.0.1
    git push origin --delete hotfix/1.0.1
    
  • When production stabilizes and you’re ready to resume the 1.1 launch, follow standard GitFlow: create a new release/1.1 branch from develop, run final tests, merge to master and develop, tag 1.1, and delete the release branch.

内容的提问来源于stack exchange,提问作者NicolasW

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:28:16