mastodon.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
The original server operated by the Mastodon gGmbH non-profit

Administered by:

Server stats:

366K
active users

Aaron Patterson ✅

Is there a way to associate a note or something with a git branch? All of my git branch names are absolute garbage because I don't want to type much when switching. But now I have a zillion branches and don't know what they're for. I'd be willing to at least write a message when making a new branch (as a note to myself)

I put nice commit messages on branches, but I can't remember the larger context 😭

@tenderlove I use fish which supports tab completing git branch names out of the box. Not what you are asking for here, but it helps me use longer names since I don’t have to type much of the name when switching branches

@tenderlove git does branch name completion, no? Or do I have something in my zshell config to enable that? It’s been this way for me so long I honestly cannot remember.

Anyhow, tab-to-trigger brand name completion doesn’t work for you? Or is insufficient?

@stevenharman completion isn't a problem. I don't want to have long branch names bc I have the branch name in my prompt. I want something more descriptive than a few words

@tenderlove ahhh, right. That makes sense.

I know of nothing built-in, but I suppose you could make an empty first commit with a description in the commit message, which you could refer to later, and then squash/rebase it out before merging. 🤷

@tenderlove I have a multi-line (2 lines) prompt with the branch, git status, Ruby version, etc… all on line 1, and my actual prompt on 2. So longer branch names don’t bother me. But I hear ya.

@tenderlove you could create draft PRs for each of them, when you create them. They give you a space for notes and context. On GitHub at least.

@tenderlove IIRC stashes allow descriptive messages though I couldn't recommend them as I've never used stashes much as I find them more frail.

Maybe you could write an alias?

Something that lists "<branch name> <commit subject>"

@tenderlove

# Add description to current branch
git branch --edit-description

# View description of current branch
git config --get "branch.$(git rev-parse --abbrev-ref HEAD).description"

git-scm.com/docs/git-branch#Do

git-scm.comGit - git-branch Documentation

@floehopper amazing. Thank you so much!!! I will try this tomorrow

@tenderlove It feels like a bit of an abuse of the branch description, which is presumably why there's no command to view the description. However, it doesn't seem like *much* of an abuse and I can't see the harm in it!

@tenderlove You could use jira and associate all your branches with jira tickets!! 💯

@tenderlove You type while switching? I use vscode, zsh, and gitx. vscode and zsh both do autocompletion - so I just type the important part of the branch name and they fill the rest. GitX is just clicky clicky. So when I name it's "something_about_the_foo_model". Then when I check out it's just "foo" and autocomplete. Bonus: I then often see if someone else is working on foo - if they named their branches well.