bin: fix git-rmbranch

This commit is contained in:
xeruf 2021-07-27 13:20:42 +02:00
parent 283e99ffae
commit d81fd43212
2 changed files with 2 additions and 3 deletions

View File

@ -101,7 +101,6 @@ edconf() {
mkdir -p "$conf_cache_dir"
touch "$conf_cache"
sel=$(listconf | fzf -1 -0 --tiebreak=end,length --preview '$(test -r "{}" || echo "sudo") bat --color=always --style=numbers --line-range :200 {}' --query="$1" --history "$conf_cache_dir/searches")
# | xargs file | grep text | cut -d':' -f1 # this filters out non-text files, but it's ridiculously slow
test "$sel" && ((echo "$sel" | cat - "$conf_cache" | head -30 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache") & edit "$sel")
}

View File

@ -2,6 +2,6 @@
# Removes the given branch locally and remotely.
# With no argument it switches to the default branch and deletes the current branch.
branch=${1:-$(git curbranch)}
echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' | xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' | xargs git push -d
test $1 || git checkout main 2>/dev/null || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -a)
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|.*/||')
git branch -D "${@:-$branch}"