-
Notifications
You must be signed in to change notification settings - Fork 85
hotfixes
Assume you have one master branch where your current development is done.
You also have an older branch, in this example it is version 1.04.
You want to change some code in both branches. This could happen, if you have to make a hotfix.
You will create a branch called myFirsthotfix for the fix and merge it in master and in version 1.04.
Each single step will be described.
First, open the repository manager
Be sure that you have both branches local.
If you don't have them local, select them from the remote branches and in the menu select checkout branch.
You checkout branch 1.04 by right click on it and selecting checkout. This loads the code of the branch 1.04 into your image.
At the end of this step, you should see your branch 1.04 in bold letters.
You create a branch for your fix by click on the branch button in the repository manager. Because you ended in the previous step with 1.04 in bold, this means that the base code for this fix is the code of the version 1.04.
You see that you now have the myFirstHotfix branch as current branch in the lower left corner of the repositories window (myFirstHotfix at 5186269). In this moment the code of 1.04 and myFirstHotfix are the same.
The changes you make in the next step for fixing the bug will be committed into this branch "myFirstHotfix".
Now fix the bug/change the code. I added one method "aFirstHotfixMethod" to my baseline class.
The package where the change was done is green now. This tells you there are uncommitted changes. You press the commit button.
The code is now committed in the "myFirstHotfix" branch.
You have one more branch in the repositories branches list.
Your new code is only in the myFirstHotfix branch.
The next steps will add the code to 1.04 and to master.
myFirstHotfix is written in bold because this is the current branch.
Switch to branch 1.04 by selecting it and choose "Checkout branch"
The Preview of checkout window tells you that when you load the code of version 1.04, the new method is no longer there because it is only in the current working copy you are about to leave.
Now, 1.04 in bold because this is the current branch.
In the repository manager, select "Merge". In the dialog, you see the current branch (1.04) and you select the branch where you want get the new code from, this is myFirstHotfix.
You see the preview of the merge. It tells you that there is only one method difference between 1.04 and myFirstHotfix. You press Press "Merge" to merge myFirstHotfix into 1.04.
This creates a merge of the myFirstHotfix code into the current 1.04 working copy.
At the end of this step, you merged the new code into version 1.04. No change yet to master.
Until now, everything is done local.
Now push this into the remote repository by clicking on push. The code is pushed to 1.04 on the remote.
You are not finished because you want to apply this changes also in master. For this, change the repository to master so that is appears in bold in the repository (checkout branch). If this branch is much newer than the branch from where you started your hotfix (in this example, 1.04) then you see a lot of code here. It shows all the code which is not in the hotfix (because this started in the old version 1.04) but in the target. This is ok, because we have a lot of new stuff in the new version. But we also want this simple new fix of myFirstHotfix in our master version. We assume that there are no conflicts e.g. the method already existing.
press checkout.
merge
Now you have 2 commits to push. One is for the new method and the other is for the methods which have been added in the meantime between 1.04 and master. (can someone please confirm this? i am not sure)