bin/git: improve branch handling
This commit is contained in:
parent
d534e538af
commit
3ebfcbe07d
|
@ -21,7 +21,7 @@ case $command in
|
|||
git aur push --amend;;
|
||||
(push)
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
git add -f .SRCINFO *.install >/dev/null || true
|
||||
git add -f .SRCINFO *.install 2>/dev/null || true
|
||||
git commit -v -a "$@"
|
||||
git push;;
|
||||
esac
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Removes the given branch locally and remotely.
|
||||
# With no argument it switches to the default branch and deletes the current branch.
|
||||
# Remove the given branch locally and remotely.
|
||||
# Without argument delete the current branch after switching to the default branch.
|
||||
branch=${1:-$(git curbranch)}
|
||||
echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' | xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' | xargs --no-run-if-empty git push -d
|
||||
test -n "$1" || git checkout main || git checkout master || git checkout $(cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | sed 's|.*/||')
|
||||
echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' |
|
||||
xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' |
|
||||
xargs -L 1 --no-run-if-empty git push -d
|
||||
test -n "$1" || git checkout main || git checkout master ||
|
||||
git checkout $(cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | sed 's|.*/||')
|
||||
git branch -D "${@:-$branch}"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Cleans up remote branches and removes branches where the remote-tracking branches got removed.
|
||||
git fetch --prune &&
|
||||
git fetch --all --prune &&
|
||||
for branch in `git branch -vv | grep ": gone]" | cut -d" " -f3`
|
||||
do git branch -D "$branch"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue