@jswork/ushell-module-git 1.0.51 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,9 +14,13 @@ DEFAULT_BRANCH=${2:-main} # 如果没有提供第二个参数,默认为 main
14
14
  echo "Switching to default branch ($DEFAULT_BRANCH)..."
15
15
  git checkout $DEFAULT_BRANCH || { echo "Failed to switch to $DEFAULT_BRANCH branch"; exit 1; }
16
16
 
17
- # 删除本地分支
18
- echo "Deleting local branch ($BRANCH_NAME)..."
19
- git branch -D $BRANCH_NAME || { echo "Failed to delete local branch $BRANCH_NAME"; exit 1; }
17
+ # 检查本地分支是否存在
18
+ if git show-ref --quiet --verify refs/heads/$BRANCH_NAME; then
19
+ echo "Deleting local branch ($BRANCH_NAME)..."
20
+ git branch -D $BRANCH_NAME || { echo "Failed to delete local branch $BRANCH_NAME"; exit 1; }
21
+ else
22
+ echo "Local branch '$BRANCH_NAME' does not exist. Skipping local deletion."
23
+ fi
20
24
 
21
25
  # 删除远程分支
22
26
  echo "Deleting remote branch ($BRANCH_NAME)..."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jswork/ushell-module-git",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "Unix like shell module for git.",
5
5
  "main": "index.sh",
6
6
  "repository": {