Skip to content

Instantly share code, notes, and snippets.

@wildlyinaccurate
Last active November 22, 2023 07:06
Show Gist options
  • Save wildlyinaccurate/daec7910958330a64754 to your computer and use it in GitHub Desktop.
Save wildlyinaccurate/daec7910958330a64754 to your computer and use it in GitHub Desktop.
Hotfix workflows

Hotfix workflows

"Traditional" gitflow workflow

  1. Create hotfix-branch from release
  2. Commit to hotfix-branch
  3. Merge hotfix-branch into both release and develop

Pros

  • Simple; everybody understands it

Cons

  • release and develop have different histories due to differing merge parents (not really an issue if you re-branch release every time)
  • Potential conflicts when merging into develop
  • Risk of merging release-only commits (e.g. version bumps) into develop

Rebase workflow

  1. Create hotfix-branch from develop
  2. Commit to hotfix-branch
  3. Merge hotfix-branch into develop
  4. Rebase (or cherry-pick) hotfix-branch onto release1

Pros

  • release and develop have the same histories (release is fast-forwarded)
  • No risk of merging unwanted commits into release or develop

Cons

  • Many people are uncomfortable with rebase (although in this case the rebase is non-destructive)

1 Using something like:

$ git rebase --onto hotfix-branch develop release
First, rewinding head to replay your work on top of it...
Fast-forwarded release to hotfix-branch.
@alanhchoi
Copy link

Thanks for the post. I guess the git command should be fixed to:

$ git rebase --onto release develop hotfix-branch

so that hotfix-branch can be transplanted to release

@hemantachhami19
Copy link

hemantachhami19 commented Sep 25, 2018

@Alan-designer is right.
$ git rebase --onto release develop hotfix-branch
one can see in
https://git-scm.com/docs/git-rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment