Skip to content

Instantly share code, notes, and snippets.

@barmic
Created November 25, 2021 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barmic/54293dce8481ab6d7c9fed64a924d063 to your computer and use it in GitHub Desktop.
Save barmic/54293dce8481ab6d7c9fed64a924d063 to your computer and use it in GitHub Desktop.
#!/bin/zsh
c=$(git branch | grep -c -- "$1")
if [[ "$c" -eq 1 ]]; then
git checkout $(git branch | grep -- "$1")
else
echo "Pattern \"$1\" is ambigus"
git branch | grep --color -- "$1"
fi
#!/usr/bin/zsh
branch=$(git branch -rl 'origin/feature/*' --format '%(refname:lstrip=2)' | grep -v <(git branch -l 'feature/*' --format '%(refname:lstrip=2)') | fzf)
git checkout -b "review/${branch#origin/feature/}" "${branch}"
git switch "review/${branch#origin/feature/}"
[[ $(git symbolic-ref HEAD) =~ /review/a ]] && exit 1
git drop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment