News for hackers. Stuff that matters.
Re:So You Think You Know Git – Git Tips and Tricks by Scott ... by bloopernova on Tuesday February 13, 2024 @09:50AM (#39358100)
This one I'm less sure about. I haven't yet gotten it to the point where I really like using it, but I'm sharing since someone might find it useful as a starting point:

  [alias]
    brancherry = "!f() { git checkout -b $(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short \"$1\") $1; }; f"
It's intended to be used for creating a cherry-picking branch. You give it an branch name, let's say "node", and it creates a branch with that as its parent, and the short commit hash as a suffix. So running "git brancherry node" creates the branch "node-abc1234" and switches to it.

The intended workflow being you cherry pick into that branch, create a PR, which then gets merged into the parent.

There are no comments on this comment yet.