Giter VIP home page Giter VIP logo

Comments (1)

AlmetovKamil avatar AlmetovKamil commented on September 14, 2024

This is indeed a popular problem with no one, generalized, agreed upon solution, so you'll have to judge based on your particular use case and experience. It must be avoided as much as possible, but sometimes it is unavoidable. Let's discuss it in more details:

Issues caused by this situation: Mainly branch divergence and speed of development. Consider first that you make your feature2 branch based on some commit in feature1, but then the dev working on feature1 decides that more changes are needed. Even worse, you find another set of changes needed for your features, and now feature1 has some code, feature2 has a different code, and both are different from the base. Merge conflicts will get nasty! You wouldn't even know which one to merge first

How to avoid: One way to prevent this problem is to keep your features as small as possible and merge frequently. If the shared dependency between feature1 and feature2 makes sense as a small "feature" on its own that neither of the features will probably need to modify, then you can merge it first and then work on the respective features.
Another way is, if possible, just take on a different feature until the dependency is resolved and then get back to feature2.

How to resolve: The simplest case would be if your feature2 is too small or can be considered a sub-feature of feature1, in which case you can just merge it into feature1 first. If it is bigger than that, you'd want to avoid this so that your PR (of feature1) doesn't become huge and full of unrelated code. A better case would be if feature1 is ready to be merged before feature2, in which case you can rebase feature1 on top of develop after the merge is done; this way you can fix any conflicts and your PR will only contain your set of changes (in fact, it's advisable to rebase continually whenever there are changes in feature1 to minimize conflicts). Lastly, if your branch is ready before the first one, you can either wait or agree with your team to merge yours first and rebase the other one on top of it.
Note that you typically shouldn't rebase already pushed commits, but if you ensure that no one else pulled the earlier changes or needs to work on this branch with you, you may overlook this rule 😅

from memorizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.