File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# Function to print help and manage arguments
44eval $(
55 zz_args " Fix git base - rebase commits from one branch to another" $0 " $@ " << -help
6- f - force force push changes to remote
7- n - dry-run show what would be done without making changes
8- - source source source branch to take commits from (default: current branch)
6+ p - push force push changes to remote
7+ d - dryrun show what would be done without making changes
98 - target target target branch to rebase commits onto
9+ - source source source branch to take commits from (default: current branch)
1010 help
1111)
1212
@@ -59,7 +59,7 @@ if [ -z "$merge_base" ]; then
5959fi
6060
6161# Get commits that are in source but not in target
62- commits_to_move=$( git rev-list --reverse " $target " .." $source " )
62+ commits_to_move=$( git log --reverse --pretty=oneline --all --ancestry-path " $target " .." $source " | grep -vE " ^[a-f0-9]+ Merge " | awk ' {print $1} ' )
6363
6464if [ -z " $commits_to_move " ]; then
6565 zz_log i " No commits to move from '$source ' to '$target '"
@@ -127,7 +127,7 @@ zz_log i "Cherry-picking commits..."
127127failed=0
128128echo " $commits_to_move " | while read commit; do
129129 if [ -n " $commit " ]; then
130- if ! git cherry-pick " $commit " ; then
130+ if ! git cherry-pick " $commit " --strategy=recursive -X theirs --allow-empty ; then
131131 zz_log e " Cherry-pick failed on commit $commit "
132132 failed=1
133133 break
You can’t perform that action at this time.
0 commit comments