I'm trying to understand a problem in creating a git-workflow
We're thinking of developing several features at once using feature branches, so lets say we have:
- F1 (Feature 1)
- F2 (Feature 2)
- F3 (Feature 3)
We have just completed features 1 and 3, and merge them into our development branch for integration testing:
-F1---Commit1---Commit2----------------------------------
-F2--------Commit1---------------------------------------
-F3--------------------------Commit1---------------------
-Development-------Merge-F1------------Merge-F2----------
The development branch is bleeding edge and gets released as part of a nightly build. When we're happy with this, this branch is merged into a staging branch, that is then used for client review:
-F1---Commit1---Commit2---------------------------------------------
-F2--------Commit1--------------------------------------------------
-F3-------------------------Commit1-----Commit2---------------------
-Development-------Merge-F1------------Merge-F2---------------------
-Staging-------------------------------------------Merge-Development
The client reviews this release on the test environment, but isn't happy with F1. During this time, F3 is code complete and the client would like to review.
Q - How using git would we get into a position whereby our staging branch has only F2 and F3 for review, but not F1 that the client has now rejected?
You can use the git revert command to revert merge commits. You have to specify the merge commit you want to revert and the parent lineage to keep. Comment on the warning. In case you will want to re-introduce F1, you will have to rebase the F1 commits, that way it should be possible to merge them in nevertheless.
Using a release branch based methodology in Git, we have a couple of options when trying to remove a feature from a release: Revert the code commits related to the features in question; or. Start a new release branch and merge only the features that are ready into that branch.
A release branch is created from develop. Feature branches are created from develop. When a feature is complete it is merged into the develop branch. When the release branch is done it is merged into develop and main.
You have basically two choices here:
revert the F1
merge in Development
and then merge that into Staging
.F1
will vanish from Development
and Staging
.
reset Staging
to the commit before merging F1
and merge F2
and F3
by hand.
You will end up with Staging
not being a subset of Development
.F1
will vanish from Staging
only.
We have a very similar flow in our project. The way we work is that we have two environments where we demo our customer:
We first deploy from the development branch to the Development environment. The customer tests the features individually in this environment.
Then, we merge to the staging branch only the features that the customer was happy with.
Finally, we deploy the final pre-release version to the Test environment for final review.
In this case we never have to remove a feature but maybe small fixes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With