(bash) fix issue gcr
This commit is contained in:
parent
217cf081d7
commit
9e1d1a1ba9
1 changed files with 3 additions and 3 deletions
|
|
@ -247,15 +247,15 @@ gcr() {
|
||||||
git fetch
|
git fetch
|
||||||
|
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
local selected_branch=$(git branch | grep "$1" | sed 's/^([ \*]*origin\/[\ *]*)*//')
|
local selected_branch=$(git branch -r | grep "$1" | sed -E 's/^([ \*]*origin\/[\ *]*)*//')
|
||||||
git switch "$selected_branch"
|
git checkout "$selected_branch"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local selected_branch=$(git branch -r | fzf | sed -E 's/^([ \*]*origin\/[\ *]*)*//')
|
local selected_branch=$(git branch -r | fzf | sed -E 's/^([ \*]*origin\/[\ *]*)*//')
|
||||||
|
|
||||||
if [ -n "$selected_branch" ]; then
|
if [ -n "$selected_branch" ]; then
|
||||||
git switch "$selected_branch"
|
git checkout "$selected_branch"
|
||||||
else
|
else
|
||||||
echo "No branch selected"
|
echo "No branch selected"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue