cookpad / cp8_cli

Cookpad Global CLI
MIT License
19 stars 10 forks source link

Branches prefix has high collision rate and make branches difficult to find #46

Open radeklat opened 4 years ago

radeklat commented 4 years ago

At the moment, cp8 generates branches prefixed with authors initials. This is problematic, because collisions with someone else in the same repository are likely.

On a related note, why is user name prefix used in the first place? It discourages collaboration (branch is "owned") and makes older branches difficult to find (do you always know who opened it?).

Alternative suggestions:

  1. <ticket number>_<summary>: Does it even need to be nested under anything? The type is irrelevant when looking for a branch name. People usually know the ticket number.
  2. feature/<ticket number>_<summary>: GitFlow approach.
  3. <ticket number>_<ticket type>_<summary>: If a ticket type is a must have. This will at least list branches by number.
  4. <github user name>/<ticket number>_<ticket type>_<summary>: No collisions, ordered by ticket number rather than type.
mattjw commented 4 years ago

I must admit the <initials>/<summary> template was a new one to me as well. I've more commonly experienced one of the following:

I concur that one of the downsides of incorporating the contributor's name is that it entangles the "changer" with the "change".

On the likelihood of collisions with the <initials> pattern: The birthday paradox is a relevant read. It's remarkable how often a collision will occur as the number of people grows. Particularly where people only use two initials.

My preference (at least within Search Squad), would be something that incorporates ticket type & ticket number & summary (the third option). Having the ticket type in there adds a bit of glanceable context. Secondary to that – i.e., if we want to continue using the author name – then github user name avoids collisions and still adequately identifies the individual. (I know some people do have non-intuitive github names, but after a bit of time working with someone you memorise the lookup.)

The initials pattern is so far very established, though, so adoption might be slow.

mattjw commented 4 years ago

One thought: Perhaps the pattern that CP8 uses could be made configurable, to allow teams to adopt their own conventions in their repositories? It'd be another first-run option, in addition to the repo access token.

balvig commented 4 years ago

Ah, the intent isn't really to have an entirely unique identifier or add significance to the branch name, it's mainly a way to:

ie for me:

  1. git checkout jb/
  2. press tab

You may indeed have to share that namespace with someone else however.

It discourages collaboration

We haven't really found this to be an issue I guess!

In general I think we pay little attention to the branch names themselves - they are disposable!

Coming from that philosophy, allowing complete customization of the prefix perhaps feels a little "heavy"?

I can imagine however making prefixing itself optional (as suggested above), but I'd be curious first to hear a bit more about how the current setup is impacting your day-to-day, and how doing so would address those problems.

I'm getting the impression that somehow the branch names themselves play a bigger role in your current workflow! 😅