-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
#!/bin/sh | ||
git fetch --all --quiet | ||
git stage -A . | ||
stash_ref="$(git stash create)" | ||
work_branch=$(git symbolic-ref --short HEAD) | ||
if git rev-parse --quiet --verify "origin/$1" >/dev/null | ||
then | ||
git stash --include-untracked | ||
stash_ref=$(git stash create) | ||
work_branch=$(git symbolic-ref --short HEAD) | ||
git switch $1 | ||
git merge --squash --strategy-option=theirs --allow-unrelated-histories $work_branch | ||
git stash apply "$stash_ref" | ||
git reset HEAD -- . | ||
else | ||
git switch --orphan $1 | ||
git commit --allow-empty -m "Initialize branch" | ||
fi | ||
git merge --squash --strategy-option=theirs --allow-unrelated-histories $work_branch | ||
if [ -n "$stash_ref" ] | ||
then | ||
git stash apply $stash_ref | ||
fi | ||
git reset HEAD -- . |