Skip to main content
FomiVIP
Tech Sharing

Two Cities, One Repo: Three New Git Branch Rules

After Wuhan began committing to the same repo, three merge conflicts hit in two weeks — one overwrote the canary config. Our branch rules became three: main takes merge requests only, branch names carry project and date, everyone pushes daily before 4 p.m. A CI check flags branches idle over 3 days.

April 16, 2021Version ControlCollaborationLessons Learned

After both cities started committing to the same repository, we had three merge conflicts in two weeks. The nastiest wasn't code — someone overwrote the canary-release config file back to an old version, the next day the test environment behaved inexplicably, and the investigation ate a whole morning. We sat down, condensed the rules, ended with three, and pinned them on the first line of the repository README.

1. main Takes No Direct Pushes

When the team was small, whoever finished pushed straight to main — quick. Two cities changed that: everything goes through merge requests, even a one-line copy change. At least one person must have looked; each city counts as a person, and it lets the other side know what's moving over here.

After the canary-config incident, config files got their own directory plus a CODEOWNERS file: touching them requires a nod from both sides.

2. Branch Names Carry Project, Date, and Purpose

Branches used to be called fix, test, new — three days later nobody remembered whose they were. The format is now project/date/short-action, e.g. ly/20210414/recon-export. One glance tells you which system, which day, doing what.

For branches idle beyond three days, CI runs a daily scan and lists them in the group chat. It's not nagging — it guards against 'started and forgotten' branches hanging around until year-end.

3. Push Once Before 4 P.M. Every Day

The humblest rule and the most useful. It doesn't require finished work — half-written, failing to compile, push it anyway with 'wip' in the message. The two cities share no timezone gap, but their rhythms differ: what Changping edits in the afternoon is visible to Wuhan that evening, no waiting until the next day to ask.

The companion rule: commit messages may not be a bare 'update.' We skipped format validation; we just require naming the file changed and why. If that config-overwrite commit message had said 'revert the canary switches,' we'd have saved the morning.

Two Small Things Along the Way

  • Completed .env.example so new colleagues can clone and run without DMing someone for the database port.
  • Added three checkboxes to the merge request template: tested locally? config touched? cron jobs affected? The third was added specifically for the reconciliation system — we've been burned before.

One Month Later

We counted again. Conflicts still happen, but they're real conflicts — both sides genuinely changed the same logic, not one side overwriting the other. Those are easy: a ten-minute meeting settles it.

Those three README lines are still there, unchanged to the character.

Consulting · Free initial chat

Need advice for your scenario?

Tell us your business context and current systems, and we'll give an actionable approach.

Contact us

Mon–Fri 9:00–18:00 · We respond on business days within one business day.

WeChat (Business Only)
WeChat (Business Only)二维码

Scan and add our WeChat for consulting

Or fill out the requirements form