2

Intro

I am using Git to control hotfixes delivered to production.

When Development team want to deliver some change to production, they create a bundle of files, called a hotfix, and send to Production team. A hotfix is indicated by its ID such as HF1, HF2, ..., HF6.

Production team is in charge of reviewing each hotfix and confirm them to deploy on production, we are trying to use git to track the status these hotfixes, suppose our git history was like

O-HF1-HF2-HF3 (production)
           \-HF4-HF5-HF6-HF7-HF8-HF9 (delivery)

where production branch has all hotfixes that have been confirmed to production and delivery branch has the rest of hotfixes delivered by development team but not confirmed to production.

Now suppose that HF8 has a change delivered as SomeJavaClass.class and we have an urgent need to deploy this hotfix to production while we have not yet finish reviewing HF4 - HF7. We would do as follows

  1. using git rebase -i HF3 and reorder the delivery branch so that HF8 become the first item next to HF3

  2. usually this will end up with a conflict because there will be some files in HF4 - HF7 that have changes to which HF8 depens. We have to find all such hotfixes and rebase them together. For exameple, suppose HF5 and HF7 also have change in SomeJavaClass.class and therefore are dependencies of HF8, we would rebase the history to

    O-HF1-HF2-HF3 (production)
               \-HF5-HF7-HF8-HF4-HF6-HF9 (delivery)
    
  3. merge production branch to HF8

    O-HF1-HF2-HF3-HF5-HF7-HF8 (production)
                           \-HF4-HF6-HF9 (delivery)
    

The question

Is there a git command that help me find all hotfixes between HF4 - HF7 that is a dependency of HF8 before doing the rebase?

Note: My purpose is to develop a shell script that, given HFX as the input, do the rebase and merge HFX and all of its dependency hotfixes in delivery branch to production branch.

asinkxcoswt
  • 2,252
  • 5
  • 29
  • 57
  • 1
    check if this tool does what you need: https://github.com/aspiers/git-deps – max630 Apr 02 '17 at 08:41
  • 1
    Note that any such tool will only be able to find dependencies where not having the commit present will cause a conflict (or similar). If you change a function in one commit to return 2 instead of 1, and this change is necessary for another commit to function correctly, then a tool that only analyzes the git repository for potential conflicts will not spot this dependency, because it is not possible to do so. – Lasse V. Karlsen Apr 02 '17 at 09:29
  • I argree, but it's general issue with cherrypicking between versions. – max630 Apr 02 '17 at 14:53
  • Another thing that if there is some big rewriting which happen to touch code changed in HF8, it would be released as well, which is probably undesired. So I would rather not use it automatically, but instead as a helper for manually selecting commits to cherry-pick. – max630 Apr 02 '17 at 14:54

0 Answers0