Reputation: 1452
In my project I have the following branches:
"staging" is where all the development happens and then before going live the "live" branch is created from "staging". Then on the "live" branch some changes are made to the config files and uploaded via FTP/Git FTP.
Now let's say there is a change request which needs to be done on both "staging" and "live" on the same set of files, but since "live" and "staging" has different config files and in some cases maybe some other different files, do I:
just manually make the changes in both branches one by one?
or create a sub-branch from either "live" or "staging" and do the changes there and then merge to both?
For option#2 if I create the sub-branch from "staging" and then after making the changes and merging, will the config files be overwritten?
or if all above approaches are wrong then how to go about it? Kindly advice.
Upvotes: 0
Views: 271
Reputation: 1774
You can use git cherry-pick
to apply a few different commits from one branch to another.
Otherwise, if you merge your staging branch back into your dev branch, git will flag for you all the conflicts that between the commits you have made on your dev branch and the commits that you made on your staging branch. This is the preferred approach, as there is one tracable commit for both branches, rather than 'duplicating' the commits via cherry-picking.
Personally I would branch the staging branch first and then merge that into staging and dev. This way you can test the changes before changing staging.
Upvotes: 1