Created
August 12, 2020 16:45
-
-
Save trajano/7c7f3f6750edbad00a477f7ef70b64e5 to your computer and use it in GitHub Desktop.
Bubble up changes for rebase
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
#!/bin/bash | |
# Usage: bubble topRef | |
if [ $( git status -s | wc -l ) -eq 0 ] | |
then | |
git rebase --skip | |
else | |
if [ "$( git status -s | grep -E '(UD|DU) ' | wc -l )" -gt 0 ] | |
then | |
git rm `git status -s | grep -E '(UD|DU) ' | c2` | |
fi | |
if [ "$( git status -s | grep -E '(UU|AA) ' | wc -l )" -gt 0 ] | |
then | |
git checkout $1 -- $( git status -s | grep -E '(UU|AA)' | c2) | |
fi | |
git rebase --continue | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment