Skip to content

Commit 18bcfcd

Browse files
authored
Merge pull request #894 from alessandro308/merge-into-stashed
Merge-into: add stash before to checkout
2 parents 68e6a15 + aa5a380 commit 18bcfcd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bin/git-merge-into

+14
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ usage() {
99
}
1010

1111
cur_branch=$(current_branch)
12+
13+
stashed=0
14+
if [ -n "$(git status --porcelain)" ];
15+
then
16+
echo "Local modifications detected, stashing"
17+
stashed=1
18+
git stash
19+
fi
20+
1221
if [ "${!#}" == '--ff-only' ]; then
1322
case $# in
1423
2 ) # dest --ff
@@ -32,3 +41,8 @@ else
3241
usage
3342
esac
3443
fi
44+
45+
if [ $stashed -eq 1 ];
46+
then
47+
git stash pop;
48+
fi

0 commit comments

Comments
 (0)