home/git/switch-interactive: fix for branchnames with '/'
This commit is contained in:
parent
df71382a47
commit
881aaedd4a
|
@ -7,5 +7,10 @@ fi
|
|||
|
||||
BRANCHES=$(cat <(git branch) <(git branch --remotes) | grep --invert-match '^\*\|HEAD ->' | sed 's|^\s*||')
|
||||
CHOSEN_BRANCH=$(fzf --reverse --info=inline --preview 'git show --color {}' <<<"$BRANCHES")
|
||||
CLEAN_BRANCH_NAME=$(sed 's|^\s*.*/||' <<<"$CHOSEN_BRANCH")
|
||||
git switch "$CLEAN_BRANCH_NAME"
|
||||
|
||||
CLEAN_BRANCH_NAME=$(sed 's|^\s*||' <<<"$CHOSEN_BRANCH")
|
||||
for REMOTE in $(git remote); do
|
||||
CLEAN_BRANCH_NAME=$(sed "s|^${REMOTE}/||" <<<"$CLEAN_BRANCH_NAME")
|
||||
done
|
||||
|
||||
git switch "${CLEAN_BRANCH_NAME}"
|
||||
|
|
Loading…
Reference in New Issue