Kot Psihopat
Kot Psihopat

Reputation: 13

How cherry-pick from one branch to another branch without checkout on this branch

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

Upvotes: 0

Views: 78

Answers (1)

eftshift0
eftshift0

Reputation: 30232

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.

Upvotes: 1

Related Questions