Best practice for fixing bug fixes in both the core and industry

If the fix needs to be fixed both in the main branch and in another branch (on the remote shared repo), what is the best practice? Since we cannot use git merge here, because not all commits in master or branch should go to another, is cherry the best choice?

-

Example:

commit fix for mastering

validation branch

FIX cherry pick from the wizard and click

-

Does the cherry pick have the same problems as rebase (never reinstall if the commit is shared?)

+4
source share
4 answers

cherry-pick is a good choice in your case!

Does the cherry pick have the same problems as rebase (never reinstall if commit is split)?

Cherry-pick has no problems, for example rebase , because it works in some way: read the difference for the commit you select and apply the patch to branch . This does not destroy the story (e.g. rebase ). After the operation, these commits will not be connected in any way!

+2
source

The preferred practice should be to make a correction on a branch, which is the common base of all branches into which the correction should be combined, and combine them with entire branches. This allows you to have a correspondence between "commit A in branch B" and "is a fix for error A in branch B".

If you do not have such a branch, of course, you can make a temporary one from a suitable point in the history, for example. found using git merge-base .

The circumstances in which this may be problematic is where the branches diverge so much that essentially you need to make a difference to solve the same problem in each branch.

eg.

 git checkout -b quickfix $(git merge-base master branch) # Note, you may want to check 'git merge-base -a' and choose the best one # code, code code git add <modified files> git commit -m "Fix for pressing issue" git checkout master git merge quickfix # Review merge and test result, fixup merge if necessary git checkout branch git merge quickfix # Review merge and test result, fixup merge if necessary # Optionally, push all branches to 'origin' git push origin branch master 
+1
source

Choosing cherries is the right choice.

Lock the master and cherry take a fix on your branch.

I don't understand your comparison with rebase , but note that cherry picking creates a whole new commit (of course, because the parent and other metadata will be different)

0
source

If you ruled out a merger, then cherry picking will remain the only option. First click the wizard, then select a branch using a form that adds the hash of the original to the commit message.

The problem with the elections is that they create a new fixation, and this makes us think about what it actually contains. Therefore, try to keep as much information as possible about relationships.

0
source

Source: https://habr.com/ru/post/1488463/


All Articles