Skip to content

Commit

Permalink
Modded scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lagergren committed Sep 15, 2024
1 parent a5098d2 commit 9fac8ee
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bin/git-delete-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

branch=$1
if [ -z "$branch" ]; then
echo "ERROR: No branch name given."
exit 1
fi

# Force delete if not merged
if ! git branch -D "$branch"; then
echo "ERROR: Failed to delete local branch $branch with -D flag."
exit 1
fi

# Delete remote branch
if ! git push origin --delete "$branch"; then
echo "ERROR: Failed to delete remote branch $branch"
exit 1
fi

echo "Branch $branch deleted."
4 changes: 4 additions & 0 deletions bin/git-rename-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ rename_branch() {
branch_new=$2
echo "Renaming $branch to $branch_new"
echo git branch -m "$branch" "$branch_new"
git branch -m "$branch" "$branch_new"
echo git push origin "$branch_new"
git push origin "$branch_new"
echo git push origin --delete "$branch"
git push origin --delete "$branch"
echo git push --set-upstream origin "$branch_new"
git push --set-upstream origin "$branch_new"
}

nargs=$#
Expand Down

0 comments on commit 9fac8ee

Please sign in to comment.