commit 59fb99bd625d8f63f634d5527e5521f496b772d7 parent be515b63beb65689295c96d290b68c86980d269e Author: Alex Balgavy <a.balgavy@gmail.com> Date: Sun, 4 Aug 2019 23:31:28 +0200 git: separate script for pulling Former-commit-id: 4ebac14a88831cc52178c1e76349c46eae091aeb Diffstat:
M | git/gitconfig | | | 3 | +-- |
A | scripts/git-pull-menu | | | 16 | ++++++++++++++++ |
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/git/gitconfig b/git/gitconfig @@ -47,8 +47,7 @@ delete-merged = "!git checkout master && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d && git fetch --all --prune" p = push pushf = push --force-with-lease - pff = pull --ff-only - pnf = pull --no-ff + pf = "!git-pull-menu" fuckit = reset --hard HEAD fuckitall = reset --hard origin/master home = "!git remote get-url origin | sed -E 's|^git@([^:]+):|https://\\1/|' | tr -d '\n'" diff --git a/scripts/git-pull-menu b/scripts/git-pull-menu @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +if ! command -v git &> /dev/null; then echo "git not found" && exit 1; fi +git fetch --all +if ! git pull --ff-only; then + select action in "Rebase" "Merge"; do + upstream="$(git branch -r | grep -v HEAD | tr -d ' ')" + case $action in + Rebase) + git rebase "$upstream" + break;; + Merge) + git merge "$upstream" + break;; + esac + done +fi