Blocking diffs on master


Is there a convenient way to block people from accidentally creating revisions with their local branch on master? I was looking at making a Herald rule, but Branch Name isn’t one of the fields you can match on in the Differential Diff or Differential Revision Herald rule types.


Why would you want that? What are you trying to achieve?


Our users sometimes get a little rushed and make changes directly on master in their local checkouts (forgetting to make a feature branch). This leads to much confusion later down the line when they’re working on the next feature branch. I was just idly thinking that I might be able to train them away from that if when they ran arc diff I could make it reject the diff and say “Please work in a feature branch; run git checkout -b feature-branch master ; git update-ref refs/heads/master refs/remotes/origin/master and try again.”.

It’s not really phabricator’s responsibility to help train users in how to properly use VCS, but if there was some convenient extension point that I hadn’t noticed, I thought it might be an easy workaround.


I don’t think “working locally on master” is the problem here, as much as “confused by how branches and remote/local work”. I suspect you’d get more mileage by training users to type origin/master instead of master in all their workflows, and/or give them aliases like git-new-feature="git checkout -b $1 origin/master".

As you’ve seen, Herald doesn’t have that option, and Revisions don’t even have to have a branch encoded (can be created using things like arc diff --head <some commit>).