Skip to content

Instantly share code, notes, and snippets.

@trajano
Created August 12, 2020 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trajano/509e0b4ddd5857ec0440ebb1343b1444 to your computer and use it in GitHub Desktop.
Save trajano/509e0b4ddd5857ec0440ebb1343b1444 to your computer and use it in GitHub Desktop.
Bubble up changes for rebase
#!/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