Git branch naming scheme
Scheme:
<your initials>/<ticket reference>-<description>/<number>-{explore,proposal,…}
Example:
rm/gt1648-make-tests-pass-under-karma/1-explore
Advantages:
- The output of
git branch
stays neat, even when you work with many branches. - The initials allow you to identify your own branches. This is helpful, for example, when you use git retire to keep the repo clean. You wouldn't want to delete your coworkers' branches.
- It will be easier for you to go back and see everything you explored for a certain ticket.
- The numbered explore- and proposal-branches allow you to rebase and squash and
edit freely while keeping other lines of exploration intact. Without this, you
would have to dig through the
reflog
to undo a botched rebase. - As the branch name contains the issue number, it's easy for your colleagues to find the changes that belong to the in-progress tickets.
- In general, when you push your feature branches to
origin
and your colleagues rungit fetch origin
, your branches show up in their branch autocompletion list. By using a common scheme, the contents of the autocompletion list will be predictable.
Details:
- If multiple contributors have the same initials, you'll have to find different shorthands.
- The ticket reference can be the issue number in Redmine, a board shortcut plus card number in Trello etc. See also Per-issue directories.
explore
is for branches where you're poking around.proposal
is for when you make neat commits that you willgit-send
or open a pull request for. You can use other labels, too, eg.test
.- I used to recommend
fix
/feature
/nonfimp
instead of your initials as a prefix. That turned out to be less useful.
I suggest composing this with git retire.