We have this branch structure:
- master (build/deployed on production)
- qa (build/deployed on Q&A environment)
- features branches
So we create a feature branch from master and then merge it to qa (created from master) when we need to validate the feature with Q&A.
Sometimes we need to rebuild qa from master because some development was directly merged to master (small ones or bug fixes).
What I did:
git checkout qa
git reset --hard master
git push --force origin qa
So the remote is now exactly just like I want it.
BUT now when the other developers do git fetch
, all the commits they have on their local qa
that were not on master appear as outgoing commits. This seems logical. We had to do a git reset --hard origin/qa
on everyone's machine but it's kind of dangerous.
Any other solution?
EDIT: Why are we doing this: Some feature that was on the qa branch were abandoned so we need to recreate the qa branch from master and then merge on it all the other branches.