3 ms·
> Do people not merge master into their branch before pushing? All that seems like mostly problem caused by having too long living branches. Well, yes, but you
by Sohcahtoa82 3y ago
> Do people not merge master into their branch before pushing? All that seems like mostly problem caused by having too long living branches.
Well, yes, but you have to run your tests.
The article outlines this scenario, but to give a more concrete definition, imagine your tests take 10 minutes, and this timeline happens:
10:00 Co-worker rebases their branch with master and begins the unit testing.
10:05 You rebase your branch with master and begin unit testing.
10:10 Co-worker's tests finish and everything looks green, pushes to master.
10:15 Your tests are done and everything is green. You try to push, but your branch is now out of date because master contains your co-workers changes! You rebase on master, restart your tests...
10:25 Your tests finish, it's green, and you finally push to master.
Ten minutes got wasted. It doesn't seem like a lot, but with enough engineers (Or long enough testing time), this scenario can happen a lot, especially with very short-lived branches.
- ilyt 3y agoAnd how merge queue not wastes that time ? Someone will have to take that step to update their code and fix it then test
- Sohcahtoa82 3y agoWith the merge queue, it works like this: 10:00 Co-worker pushes their code to the merge queue. CI/CD pipeline begins running unit tests. 10:05 You push your code to the queue. 10:10 CI/CD finishes the tests. It looks green. Their code gets merged to master. CI/CD starts running your unit tests with the new master branch and your code applied. 10:20 CI/CD finishes the tests with your code, tests are green, and merges to master. Five minutes were saved by using a merge queue.