How can I easily apply a bugfix on several release branches in Git?

I’ve been using git for a while for my one-man developments, but I haven’t run into any tricky branching issues until now and I seem to have forgotten something fundamental that I no doubt “knew” just after reading the Pragmatic Version Control Using Git Book..

I’m often several releases ahead of what is actually published on my website, so that when a bug report comes in, I only apply them to the current master branch rather than fixing them in the next released version. Of course, I’d like to change that to get fixes out quicker.

  • How can I recover a commit to an unnamed branch in Git?
  • Git: Teamwork across branches without Push Permission
  • Can't push branch to github
  • GIT: How to unambiguously reference current HEAD when having a branch called HEAD?
  • Coder collaboration best practices using Git
  • Git create a new branch with only a specified directory and its history then push to new repository
  • Let’s say 1.0 was just released, 1.1 is going to be released soon, but I’m already working on 1.3, e.g.

    1.0 - released  
    1.1 - finished  
    1.2 - finished  
    1.3 - in development  
    

    A bug report comes in.. usually this would be fixed in 1.3, but how do I fix it in 1.1 instead?

    As far as I am aware in svn and other “traditional” source control systems, I would need to branch B.1.1 and B.1.2 and apply the changes to each branch in turn, then build from each branch and finally apply the fix to the master branch.

    I seem to remember that git, however, does something clever: I branch B.1.1, make the changes there, do {something} and B.1.2 and the master branches are automagically updated with the fix. Is this possible or did I imagine {something}?

  • Promote Git branch to master
  • difficulty in importing the facebook-android-sdk into eclipse
  • Is there a quick git command to see an old version of a file?
  • Using Git/Github properly when working on a team
  • Visual Studio 2013 and BitBucket
  • Why can't I view the MyWork pane in TFS plugin for VisualStudio 2012 when using Microsoft Git Provider?
  • 2 Solutions collect form web for “How can I easily apply a bugfix on several release branches in Git?”

    The right way in this case would be to:

    • make sure you have B1.1 and B1.2 created (to isolate final fixes in their respective branch)
    • apply your patch on master
    • cherry-pick that commit to B1 and B2

    As mentionned in this thread, that would:

    ensures master doesn’t regress with respect to an older branch. (Do not use merge unless you want to merge all changes from one branch to another, rather than just the single commit
    you mention.)

    What about in this case fixing on B1.1, merging B1.1 into B1.2, then B1.2 into B1.3?

    Git Baby is a git and github fan, let's start git clone.