Changes to function branches after merging to master

I am looking for a way to make changes to function branches after combining them with the wizard. The goal is to save the feature branch containing only the commits associated with it.

It often happens that a function requires some additional polishing after it has already been pressed for mastering. Changes that were made for development during this time do not conflict with this function, which means that when additional work is implemented, the actual wizard may be rearranged in the branches of the attribute.

The following figure shows the situation:

enter image description here

The approach I have used so far: Rebase to control and combine functions back into the master

enter image description here

Against β†’ the function branch is now dictated by parts from the master.

enter image description here

Question: What are the methods that you are taking in practice to solve this problem?

Code example

To describe the approaches below, this is the code to create the repo structure from the examples.

# mkdir test git init touch master-change-file git add master-change-file git commit -m "initial commit" echo 1 > master-change-file git commit -a -m "master commit 1" echo 2 > master-change-file git commit -a -m "master commit 2" git checkout -b feature echo 3 > feature-change-file git add feature-change-file git commit -a -m "feature commit 1" echo 4 > feature-change-file git commit -a -m "feature commit 2" echo 5 > feature-change-file git commit -a -m "feature commit 3" git checkout master git merge --no-ff feature -m "Merge branch 'feature'" git checkout feature echo 6 > feature-change-file git commit -a -m "feature commit 4" echo 7 > feature-change-file git commit -a -m "feature commit 5" git checkout master echo 8 > master-change-file git commit -a -m "master commit 3" echo 9 > master-change-file git commit -a -m "master commit 3" # gitk --all 
+3
git git-flow
source share
1 answer

The approach I've used so far: Rebase to control and merge functions back into master

I think you might be a little confused about the purpose of the reboot. If you made new commits for a function branch after merging it with master , and you want to make these new changes to master , and then reinstalling is one of the options. Consider the following diagram:

 master: A <- B <- C <- D feature: A <- B <- C <- E <- F 

If you should have done:

 git checkout feature git rebase master 

then you will be left with:

 master: A <- B <- C <- D feature: A <- B <- C <- D <- E' <- F' 

At this point, you simply push the feature branch to master , you would not merge it. Merging feature in master after reinstalling is pointless and defeats the goal of rebooting, which is to maintain linearity.

Finally, here is the answer to your question. You basically have two options for handling these function branches that have new changes. You can either team up or reinstall. It is up to you to decide whether you want to keep the original commits that took place in the function branches.

+3
source share

All Articles