config/git: improve pulling

This commit is contained in:
xerus2000 2021-04-21 19:51:14 +02:00
parent 3cb530f077
commit 82c053886d
2 changed files with 4 additions and 3 deletions

View File

@ -135,14 +135,15 @@
f = fetch f = fetch
fa = fetch --all fa = fetch --all
fs = !git fetch && git st fs = !git fetch && git st
lu = !git pull --rebase upstream ${1:-$(git curbranch)} lu = !git pull upstream ${1:-$(git curbranch)}
rg = rmgonebranches rg = rmgonebranches
su = submodule update --init --recursive su = submodule update --init --recursive
gcr = !git gc && git repack -a -d gcr = !git gc && git repack -a -d
# Change remote # Change remote
luu = !git pull upstream $(git curbranch) && git push --no-verify ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease
luu = !git pull upstream ${1:-(git curbranch)} && git push --no-verify
pf = push --force-with-lease pf = push --force-with-lease
cap = !git commit --all --amend --no-edit && git push --force-with-lease cap = !git commit --all --amend --no-edit && git push --force-with-lease

View File

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