config/git: rework git-p

This commit is contained in:
xerus2000 2021-02-16 13:11:05 +01:00
parent b6fd5446c6
commit 5a82e182fc
3 changed files with 4 additions and 4 deletions

View File

@ -136,12 +136,10 @@
# Change remote # Change remote
luu = !git pull upstream $(git curbranch) && git push --no-verify luu = !git pull upstream $(git curbranch) && git push --no-verify
p = push
pu = push -u
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
[includeIf "gitdir:~/.config/yadm/repo.git"] [includeIf "gitdir:yadm/repo.git"]
path = "~/.config/yadm/gitconfig" path = "~/.config/yadm/gitconfig"
[includeIf "gitdir:~/data/.git"] [includeIf "gitdir:~/data/.git"]

2
.local/bin/scripts/git-p Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
git rev-parse @{u} 2>/dev/null >/dev/null && git push || git push --set-upstream

View File

@ -3,5 +3,5 @@
# 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/\// /' | git push -d
test $1 || git checkout main || 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}"