Created
December 17, 2021 17:54
-
-
Save adamschlesinger/50d1e1266b50abb2876769577b18869f to your computer and use it in GitHub Desktop.
Hacky script for helping with extensive rebases if you primarily only care about the changes from the current branch
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 | |
current_status=$(git status) | |
handleRebaseStatus() { | |
local status_string=$1 | |
local git_resolution=$2 | |
paths_to_resolve=$(echo "${current_status}" | pcregrep -o2 "(?<=${status_string}:)(\s*)(.+)") | |
echo "RESOLVING \"${status_string}\"" | |
for path in $paths_to_resolve | |
do | |
git "${git_resolution}" "${path}" | |
done | |
} | |
handleRebaseStatus "added by us" "rm" | |
handleRebaseStatus "deleted by us" "rm" | |
handleRebaseStatus "added by them" "add" | |
handleRebaseStatus "deleted by them" "rm" | |
handleRebaseStatus "both modified" "add" | |
git rebase --continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment