From aa5a3809962f4deee8e1a4479adabd03dd11c5e3 Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Mon, 16 Nov 2020 11:33:59 +0100 Subject: [PATCH] Merge-into: add stash before to checkout --- bin/git-merge-into | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/git-merge-into b/bin/git-merge-into index ddaaea9..0561a8d 100755 --- a/bin/git-merge-into +++ b/bin/git-merge-into @@ -9,6 +9,15 @@ usage() { } cur_branch=$(current_branch) + +stashed=0 +if [ -n "$(git status --porcelain)" ]; +then + echo "Local modifications detected, stashing" + stashed=1 + git stash +fi + if [ "${!#}" == '--ff-only' ]; then case $# in 2 ) # dest --ff @@ -32,3 +41,8 @@ else usage esac fi + +if [ $stashed -eq 1 ]; +then + git stash pop; +fi