GIT alternative to cherry picking

Issue

I’ve the following git structure problem within my team. Our structure is as follow:

Branches

  • Master (release tags)
  • Staging
  • Development

And everybody is coding on development, and if they wanna push the changes then they cherry-pick their commits to staging and then merge staging with master.

We want to work with feature branches but I don’t know how. The problem is.

  • We work with a product where we create new custom features with several developers.
  • When the feature is done, then it will be pushed to development branch and then the client can test it. It is possible to push several features and different client sections need to test. If 1 client section approved the feature then the developer cherry-picked that one feature and push it to staging.
  • It isn’t possible to merge everytime from the development to the staging, because it contains features that are not allowed on the staging.
  • It isn’t possible that we wait till the feature is tested and then work on another feature, because that cost time, and we need to wait on the client before we can show that feature on staging.

How can we add the following structure

  • Master (release tags)
  • Staging
  • Development
  • feature/*
  • hotfix/*

Solution

Work on a feature branch, one per feature, and after submitting it as a PR and reviewing it among the developers, merge it to development.

Tell the clients to test. Meanwhile continue working on other feature branches.

When the client approves the feature, merge the same feature branch to staging. (Even if you have deleted the branch name prematurely, if you used a PR, the branch’s last commit remains accessible because the PR exists forever, marking the place.)

Answered By – matt

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published