Skip to content

Commit c18529b

Browse files
committed
fix(gitutils): 🐛 update help message to clarify source branch argument
1 parent 7195876 commit c18529b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/gitutils/_git-fix-base.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Function to print help and manage arguments
44
eval $(
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
5959
fi
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

6464
if [ -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..."
127127
failed=0
128128
echo "$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

0 commit comments

Comments
 (0)