Created
November 25, 2021 21:32
-
-
Save barmic/54293dce8481ab6d7c9fed64a924d063 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[ $(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