简体   繁体   中英

Git workflow - Branching a branch

I have done some refactoring in a branch, let's call the branch RenameCustomersTableToClients. This branch can not be merged to the trunk for at least a week. The changes in it are a little too risky given that we have a release scheduled in a few days.

Right now I am about to start working on a new feature. This feature needs the changes introduced in branch 1. So I will branch that branch, creating a 2nd branch. Let's call this second branch NewClientRelatedFunctionality.

I am expecting branch 1 to be merged into the trunk in about a week. Then roughly a week later I will be wanting to merge my 2nd branch into the trunk. This should be fine, right? I am quite new to git and just want to make sure that I am not opening a can of worms here.

It won't be a problem. More to the point, you don't really have a choice from what it sounds like.

If feature/B is dependent on feature/A then it has to be branched off from it. Both technically and semantically it makes sense to do so.

If you are concerned about changes in the trunk (or master) branch being incompatible, you can merge it into your feature branch, numerous times if you have to, in order to keep your feature branch up to date with the latest changes.

This is only really necessary if you know there's likely to be a lot of incompatibility. It's a lot easier to do those kinds of merges when the code is fresh in your mind rather than a week or so after the event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM