'Procedure for developing on top of feature branch when original feature branch is merged with a squash
It's not that uncommon when I find myself:
- needing to work on the next feature
- before the latest work is integrated to the main branch
- and new work requires code from the previous branch
- and the merge into main is a squash.
When this happens, merging is painful.
The scenario:
git checkout develop
git checkout -b feature/A
git commit -am "A1"
git commit -am "A2"
git push // + start a pull request
//Before the pull request is finished
git checkout -b feature/B
git commit -am "B1"
// Pull request is accepted and merged as a squash
// Other pull requests
git fetch origin develop
git merge origin/develop
(conflicts)
Now:
feature/BhasA1,A2,B1- and
develophas a commitD1that has the changes fromA1andA2 - and git cannot know that
D1isA1+A2 - and it rightly marks places where
feature/Btouches code changed byfeature/Aas conflicts.
Ideally I would love to be able to:
- not have conflicts where what's coming in from
developtofeature/Bcame fromfeature/Aand - have conflicts if the change came from another branch (or not from commits
A1andA2.
Is that possible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
