Search code examples
gitgit-cherry-pickgit-bare

git: cherry-pick in bare repo


My server-side bare git repo needs to periodically cherry-pick commits from a special branch onto master (executed from a hook).

Is there any way to avoid a checkout and do this directly in the bare repo?

Edit: Since the cherry-picking procedure is non-interactive, it is okay to completely error out if the cherry-pick isn't trivial to apply.


Solution

  • Current solution is for the hook to make a temporary shallow checkout, perform the cherry-pick there, push back to the bare repo, and (possibly) remove the temporary checkout.

    I'll accept a different answer if there is a way to do this without a temporary checkout.