Skip to content

Instantly share code, notes, and snippets.

@BKmetoff
BKmetoff / git_open_pr.sh
Created March 29, 2023 09:12
CLI git helper - open PR
#!/bin/bash
fuzz="fzf --height=40% --no-color --no-info"
base_url="https://github.com/"
url_pr=`gh search prs --author <author name> --state open | $fuzz | awk '{printf "%s/pull/%s",$1,$2}'`
open "$base_url$url_pr"
@BKmetoff
BKmetoff / git_go_to_repo.sh
Created March 29, 2023 09:10
CLI git helper - open repo from selected organisation/user
#!/bin/bash
fuzz="fzf --height=40% --no-color --cycle --margin=5% --padding=1 --no-info"
orgs=`echo "<list of orgs separated by space>" | tr ' ' '\n'`
selected_org=`printf "$orgs" | $fuzz`
selected_repo=`gh repo list $selected_org --no-archived -L 100| $fuzz | awk '{print $1}'`
open "https://github.com/$selected_repo"
@BKmetoff
BKmetoff / git_branch_helper.sh
Created March 29, 2023 09:06
CLI git branch helper - operate on git branches.
#bin/bash
fuzz="fzf --height=40% --border --color=light --cycle --margin=15% --padding=1 --no-info"
print_columns="pr -2 -t -w 100"
operations=`echo "checkout delete create list remote-list remote-checkout" | tr ' ' '\n'`
selected_operation=`printf "$operations" | $fuzz`
if [[ "$selected_operation" == "remote-list" ]]; then
echo "\n Remote branches, not merged in main:\n"