Created
August 12, 2020 16:45
-
-
Save trajano/509e0b4ddd5857ec0440ebb1343b1444 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