0

I'm trying to use rugged (ruby) to cherry pick a commit on a branch like this:

repo.fetch('origin', ['origin/stable/branch_name'],credentials: rugged_credentials)
repo.reset('origin/stable/branch_name', :hard)

repo.checkout('origin/stable/branch_name')
repo.cherrypick('929bab12fdf6f4727ba0a8d704df01fe1e780449')

But it seems that the cherry pick is producing uncommitted changes, I would expect to have that commit on that branch and just need to push it to the remote reference.

This is the output of git status after cherry-picking:

HEAD detached from 3807abe
You are currently cherry-picking commit 929bab1.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

        modified:   README.md

And if I push to the remote after a cherry pick I got:

>
irb(main):033:0> repo.remotes['origin'].push("HEAD:refs/heads/stable/branch_name",credentials: rugged_credentials)
=> {"refs/heads/stable/2021-12-01"=>"internal error"}

It seems that cherry-pick is doing something like:

git cherry-pick 929bab12fdf6f4727ba0a8d704df01fe1e780449 --no-commit

But I don't see an option for that in Rugged cherrypick

Kerby82
  • 4,934
  • 14
  • 48
  • 74

1 Answers1

0

It turns out cherry-pick in rugged does not auto-commit so an explicit manual commit is needed. You can use the author and commit-message from the commit is being picked.

Kerby82
  • 4,934
  • 14
  • 48
  • 74