'Is there a git-native way to fast-forward merge multiple branches?
I'm working on an infrastructure-as-code deployment, managed with git and some build piplines.
We have a branching structure like below. We develop on master, move test forward to a specific commit/branch, and eventually move forward the prod-company-X deployments to a specific commit/branch. Below is obviously simplified, we have many production deployments.
* 1fee83a - (1 day ago) Implement New Feature E - Caesar Kabalan (master)
* 629a6c6 - (3 days ago) Implement New Feature D - Caesar Kabalan
* a5596f0 - (5 days ago) Implement New Feature C - Caesar Kabalan (HEAD -> test)
* de59ad0 - (10 days ago) Implement New Feature B - Caesar Kabalan
* 1aa293b - (20 days ago) Implement New Feature A - Caesar Kabalan (prod-company-a, prod-company-b, prod-company-c, prod-company-d)
* bd1654f - (1 month ago) Initial Product Release - Caesar Kabalan
In our example we would like to move all prod-* branches to the test level, resulting in:
* 1fee83a - (1 day ago) Implement New Feature E - Caesar Kabalan (master)
* 629a6c6 - (3 days ago) Implement New Feature D - Caesar Kabalan
* a5596f0 - (5 days ago) Implement New Feature C - Caesar Kabalan (HEAD -> test, prod-company-a, prod-company-b, prod-company-c, prod-company-d)
* de59ad0 - (10 days ago) Implement New Feature B - Caesar Kabalan
* 1aa293b - (20 days ago) Implement New Feature A - Caesar Kabalan
* bd1654f - (1 month ago) Initial Product Release - Caesar Kabalan
Thus far we've been using a script which loops through branches, checking each out and merging it with our target branch.
Is there a git-native way to move all branches, or a subset of branches, to a specific commit or other branch? Something with merge --ff-only would be preferred, but we're open to reset --hard or less "safe" options.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
