Skip to content

Commit 52a78f2

Browse files
feat: allow to select which branch to refresh (#3241)
1 parent b8d49c9 commit 52a78f2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

bin/git_fresh

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ if ! command -v git >/dev/null 2>&1; then
55
exit 1
66
fi
77

8+
branch="${1:-"master"}"
9+
10+
echo "Refresing branch ${branch}"
11+
812
git fetch --all
9-
git checkout --quiet origin/master
10-
git branch -D master
11-
git checkout -b master
12-
git branch -u origin/master
13+
git checkout --quiet "origin/${branch}"
14+
git branch -D "${branch}"
15+
git checkout -b "${branch}"
16+
git branch -u "origin/${branch}"
1317
git submodule update --init --recursive
14-
git branch | grep -v -E "(^\*|master|remotes)" | xargs git branch -D
18+
git branch | grep -v -E "(^\*|${branch}|remotes)" | xargs git branch -D
1519
rm -rf ./**/*.orig || true

0 commit comments

Comments
 (0)