aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/git/config
diff options
context:
space:
mode:
Diffstat (limited to '.config/git/config')
-rw-r--r--.config/git/config11
1 files changed, 11 insertions, 0 deletions
diff --git a/.config/git/config b/.config/git/config
index c5d639d..b9f22a6 100644
--- a/.config/git/config
+++ b/.config/git/config
@@ -191,3 +191,14 @@
echo \"$1\" >> \"$(git rev-parse --git-dir)/info/exclude\"; \
fi; \
}; __fn"
+ sync-upstream = "!__fn() { \
+ local branch=\"$(git current-branch)\"; \
+ if git rev-parse --verify --quiet \"origin/$branch\" > /dev/null 2>&1 && \
+ git rev-parse --verify --quiet \"upstream/$branch\" > /dev/null 2>&1; then \
+ git reset --hard \"upstream/$branch\" && \
+ git push --force-with-lease origin \"$branch\"; \
+ else \
+ echo \"error: branch '$branch' not found on both origin and upstream\" >&2; \
+ exit 1; \
+ fi; \
+ }; __fn"