Skip to content

Instantly share code, notes, and snippets.

@rsitze
rsitze / gitp
Last active October 15, 2024 11:27
Find nearest (in commit history) parent branch of a given base branch using regex patterns for likely parent branch names. See https://stackoverflow.com/a/68673744/1448212
#!/usr/local/bin/bash
# For a walk through of what this does, how it works,
# see: https://stackoverflow.com/a/68673744/1448212
# git show-branch supports 29 branches; reserve 1 for current branch
GIT_SHOW_BRANCH_MAX=28
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
@rsitze
rsitze / gitr
Last active January 13, 2025 13:18
Find nearest (in commit history) related branch(es) given a base branch. See https://stackoverflow.com/a/68673744/1448212
#!/usr/local/bin/bash
# For a walk through of what this does, how it works,
# see: https://stackoverflow.com/a/68673744/1448212
# git show-branch supports 29 branches; reserve 1 for current branch
GIT_SHOW_BRANCH_MAX=28
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"