Home > front end >  How cherry-pick from one branch to another branch without checkout on this branch
How cherry-pick from one branch to another branch without checkout on this branch

Time:02-01

I have 3 branches. dev, master, master_copy. Now I am on the master branch and a need cherry-pick commit from dev branch to master_copy WITHOUT checkout to master_copy or dev branch. How I can do this?

I need like this cherry-pick <hash> dev master_copy

CodePudding user response:

If you do not want to checkout something else consider using a worktree for that:

git worktree add blah master_copy
cd blah
git cherry-pick some-commit
cd ..
git worktree remove blah

It's an overkill but at least will allow you to cherry-pick without moving on the default working tree.

  • Related