From 82c053886d5c6b65b1d8cdc574010fef39dfb451 Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Wed, 21 Apr 2021 19:51:14 +0200 Subject: [PATCH] config/git: improve pulling --- .config/git/config | 5 +++-- .local/bin/scripts/git-rmbranch | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.config/git/config b/.config/git/config index 937be6c..2c86d8a 100644 --- a/.config/git/config +++ b/.config/git/config @@ -135,14 +135,15 @@ f = fetch fa = fetch --all fs = !git fetch && git st - lu = !git pull --rebase upstream ${1:-$(git curbranch)} + lu = !git pull upstream ${1:-$(git curbranch)} rg = rmgonebranches su = submodule update --init --recursive gcr = !git gc && git repack -a -d # 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 cap = !git commit --all --amend --no-edit && git push --force-with-lease diff --git a/.local/bin/scripts/git-rmbranch b/.local/bin/scripts/git-rmbranch index 8423666..7db7130 100755 --- a/.local/bin/scripts/git-rmbranch +++ b/.local/bin/scripts/git-rmbranch @@ -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/\// /' | 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) git branch -D "${@:-$branch}"