git cherry-pick to another branch

Crazy idea (based on mnaoumov's comment) if you really want to avoid touching the checked out files (say you don't want to disturb your build system) … that's what I want anyway.

  1. Clone the whole git repo to a temporary directory.
  2. Do the work in the clone.
  3. Add the clone as a remote.
  4. git fetch clone && git branch mybranch clone/mybranch -f
  5. Clean up.

This would be a thing to automate. If you have filesystem snapshots, cloning the whole repo is cheap – perhaps not so crazy after all…


https://github.com/lennartcl/gitl provides "git cherry-copy" and "git cherry-move" scripts that do this and handle most of the corner cases.


That's not possible - simply imagine what would happen if there was a conflict that couldn't be resolved automatically. For the same reason you also can't update branches that are not currently checked-out (even if a fast-forward was possible).